Inline Function is a function that requests the compiler to do inline expansion. In other words, where in normal functions, upon call of a function the execution of the function goes to the definition of the function, in inline function, compiler insert the complete body of the function in every place that the function is called. Inline expansion is used to eliminate the time overhead (excess time) when a function is called. Using the inline function is very simple, one need to just put the keyword ‘inline’ in front of the function definition.
using namespace std;
inline void hello()
hello(); //Call it like a normal function...
Besides the advantage of Inline function of making the execution of function fast, these are not used in the functions that are tremendously large. This is because when the large functions are made inline, these make the programs inefficient.
Note, rather a warning : the functions with loops should not be made inline as loops increases the size of the function and thus making them inline causes performance overhead.