C++ Inline Function Question:
Download Questions PDF

Explain inline function?


An inline function is a combination of macro & function. At the time of declaration or definition, function name is preceded by word inline.

When inline functions are used, the overhead of function call is eliminated. Instead, the executable statements of the function are copied at the place of each function call. This is done by the compiler.

Consider following example:

#include <iostream>
using namespace std;

inline int sqr(int x)
int y;
y = x * x;
return y;
int main()
int a =3, b;
b = sqr(a);
cout <<b;
return 0;

Download C++ Inline Function Interview Questions And Answers PDF

Previous QuestionNext Question
Define Inline Function?Explain static member functions?