Inline Function in C++

An inline function is a function that is expanded in line when it is invoked, the compiler replaces the function call with the corresponding function code. It has the following syntax :

inline function-header
{
 functions of the body
}

Example :
inline float square (float a)
{
  return(a*a);
}

Program :

#include<iostream.h>
#include<conio.h>
using namespace std;
inline float add(float a, float b)
{
 return(a+b);
}
inline double sub(double c, double d)
{
 return(c-d);
}
int main()
{
 float x=15.7567;
 float y=12.56;
cout<<add(x,y)<<endl;
cout<<sub(x,y)<<endl;
return 0;
}