Inline Function:- The Inline function are those that can be expand at the time of compilation. inline function is a combination of macro & function. Either at the time of declaration or definition of function place the keyword inline before the function name. we can also declare the member function as inline. inline functions can be expand at the time of compilation so It relieves the burden involved in calling a function.
NOTE:- The compiler can ignore the inline qualifier in case defined function is more than a line. don't put any looping statement inside that function otherwise that is not treated as inline.
inline.cpp
#include<iostream.h>
#include<conio.h>
inline add(int a,int b)
{
return (a+b);
}
void main()
{
clrscr();
cout<<add(2,3);
getch();
}
0 Comment(s)