Inline Function in C++

Google Advertisements

Prev Tutorial Next Tutorial

Inline Function in C++

Inline Function is powerful concept in C++ programming language. If a function is inline, the compiler places a copy of the code of that function at each point where the function is called at compile time.

To make any function inline function just preceded that function with inline keyword.

Why use Inline function

Whenever we call any function many time then, it take a lot of extra time in execution of series of instructions such as saving the register, pushing arguments, returning to calling function. For solve this problem in C++ introduce inline function.

Advantage of Inline Function

The main advantage of inline function is it make the program faster.


inline function_name()
  //function body



inline void show()
  cout<<"Hello world";

void main()
 show();  // Call it like a normal function


Hello word

Where inline function not work ?

  • If inline function are recursive
  • If function contain static variables.
  • If return statement are exits but not return any value.

Prev Tutorial Next Tutorial

Google Advertisements

Buy This Ad Space @$50 per Month, Ad Size 600X200 Contact on: or 8076671483

Pure VPN Privide Lowest Price VPN Just @ $1.65. Per Month with Non Detected IP Lowest Price Non Detected IP VPN

Magenet is best Adsense Alternative here we earn $2 for single link, Here we get links ads. Magenet

Cloud computing is the on demand availability of computer system resources, especially data storage and computing power, without direct active management by the user. Cloud Computing Tutorial

College Projects Related to Java, AWT, C Projects for College, C++ Projects for College, Android Projects. Download Java C C++ Projects

Download Projects

Adsense Advertisements

Buy This ads Space 8076671483

Buy This Ad Space @$120 per Month, Ad Size 300X600 Contact on: or 8076671483 Try this Keyword C++ Programs