std::is_heap( ) in C++ with Examples
The std::is_heap() function in C++ Standard Template Library is used to check whether a given range of elements forms Max Heap or not. It returns True when given ranges of elements forms Max Heap, else it returns False....
read more
How to Return a Pointer from a Function in C++?
In C++, we can return a pointer from a function which is useful when we want to return large data structures that cannot be returned by value. However, it must be done carefully to avoid memory leaks, dangling pointers, and other issues related to dynamic memory management. In this article, we will learn how to return a pointer from a function in C++....
read more
Pass Array to Functions in C
In C, the whole array cannot be passed as an argument to a function. However, you can pass a pointer to an array without an index by specifying the array’s name....
read more
Const member functions in C++
Constant member functions are those functions that are denied permission to change the values of the data members of their class. To make a member function constant, the keyword const is appended to the function prototype and also to the function definition header....
read more
Default Arguments in C++
A default argument is a value provided in a function declaration that is automatically assigned by the compiler if the calling function doesn’t provide a value for the argument. In case any value is passed, the default value is overridden....
read more
Virtual Functions and Runtime Polymorphism in C++
A virtual function is a member function that is declared in the base class using the keyword virtual and is re-defined (Overridden) in the derived class. It tells the compiler to perform late binding where the compiler matches the object with the right called function and executes it during the runtime. This technique falls under Runtime Polymorphism....
read more
Is it fine to write void main() or main() in C/C++?
In C/C++ the default return type of the main function is int, i.e. main() will return an integer value by default. The return value of the main tells the status of the execution of the program. The main() function returns 0 after the successful execution of the program otherwise it returns a non-zero value....
read more
When to Use Lambda Expressions Instead of Functions in C++?
In C++, both lambda expressions and functions are used to define operations that can be invoked somewhere else in the code. However, there are some cases where using lambda expressions can be more beneficial than using functions. In this article, we will learn when to use lambda expressions instead of functions in C++....
read more
boost::algorithm::one_of_equal() in C++ library
The one_of_equal() function in C++ boost library is found under the header ‘boost/algorithm/cxx11/one_of.hpp’ which tests if exactly one of the elements of a sequence against the value passed is same. It takes a sequence and a value, and returns true if the exactly one of the elements are same in the sequence to the value passed....
read more
valarray min() in C++
The min() function is defined in valarray header file. This function returns the smallest value contained in the valarray....
read more
unordered_set operator= in C++ STL
The ‘=’ is an operator in C++ STL which copies (or moves) an unordered_set to another unordered_set and unordered_set::operator= is the corresponding operator function. There are three versions of this function....
read more
unordered_set empty() function in C++ STL
The unordered_set::empty is a built-in function in C++ STL which is used to check if an unordered_set container is empty or not. It returns True if the unordered_set container is empty, otherwise it returns False....
read more