Inline functions in C++

Inline functions are the ones which are not called  but their code is expanded inline at point of their invocation. They are more of a request to a compiler.  Inline functions are used to generate more efficient codes since there is no function call and there are no overheads involved. Thus, it makes a program runs faster. It is generally used for smaller functions since it increases the size of the code.

For Example:

#include <iostream>

using namespace std;

inline int min(int i, int j)


return i<j ? i : j;


int main()


cout << min(35, 25);

cout << ” ” << min(67, 58);

return 0;


Leave a Reply