The function that is declared with the help of keyword ‘inline’ is known as Inline Function.
It is a function that will expand inline at each point in a program where it is invoked. Also we can say that function body is inserted at the place of function calling whenever the compiler compiles the program so that compiler do not have to go at function definition again and again for each function call.
Like this overheads of compiler will reduced and execution time improves.
Whenever a function is called the following task will be performed,
- Storing the memory address of instructions that are used.
- The different type of values will be saved in registers.
- Actual arguments are pushed or inserted onto the stack.
- Arguments of called function will be popped or deleted from the stack.
inline <returntype> <functionname>(parameters)
inline int maximum(int x, int y)
return (x>y? x: y);
void main ()
int m= 11, n= 25;
int a, b;
a= maximum(16, 18);
cout<<” Maximum of 16 and 18 is:- “<<a;
b= maximum(m, n);
cout<<” \nMaximum of “<<m<<” and ”<<n<<” is:-“<<b;
Maximum of 16 and 18 is:-1 8
Maximum of 11 and 25 is:- 25
You Also Can Visit For More Knowledge In C++:-
Visit Your Website :- www.atozlives.com
“Play With All Computer Science , Mathematics And Technology.”