Skip to content

Tag Archives: CPP-Functions

count_if() function returns the number of elements in a range that satisfy the condition. Syntax:  template <class InputT, class UnaryPredicate> typename iterator_traits <InputT> :: difference_type… Read More
The fdim() function takes two arguments and returns the positive difference between first and second argument. This function returns a-b if a>b otherwise returns 0.… Read More
The std::cbrt() is an inbuilt function in C++ STL which is used to calculate the cube root of number. It accepts a number as argument… Read More
A callback is any executable code that is passed as an argument to other code, which is expected to call back (execute) the argument at… Read More
When we pass an array to a function, a pointer is actually passed. However, to pass a vector there are two ways to do so:… Read More
Function Overloading (achieved at compile time) Function Overloading provides multiple definitions of the function by changing signature i.e. changing number of parameters, change datatype of… Read More
Here, we will build a C++ program to return a local array from a function. And will come across the right way of returning an… Read More
Void functions are known as Non-Value Returning functions. They are “void” due to the fact that they are not supposed to return values. True, but… Read More
There can be some instances where you need to return multiple values (maybe of different data types ) while solving a problem. One method to… Read More
Consider the following program. Predict the output of it when compiled with C and C++ compilers. C #include<stdio.h>   void func() {     /* definition */… Read More
Please note that the title is Functors (Not Functions)!! Consider a function that takes only one argument. However, while calling this function we have a… Read More
Function interposition is the concept of replacing calls to functions in dynamic libraries with calls to user-defined wrappers. What are applications? We can count number… Read More
A macro is a name given to a block of C statements as a pre-processor directive. Being a pre-processor, the block of code is communicated… Read More
Consider below C program. The program has extra bracket around function name. // C program to show that extra brackets with function // name work… Read More
Although polymorphism is a widely useful phenomena in C++ yet it can be quite complicated at times. For instance consider the following code snippet:  CPP… Read More