What is Inline Function and how to write inline function

The inline function is a function which is expanded in line when it is called. In inline function  the compiler replaces the function call with the function code so it eliminate the overhead of function calling.

Why we use inline function and their advantages

It  executes much faster because the overhead of a function call and return is eliminated.

Subscribe Our Tutorials

Get Latest Updates on Facebook

Syntax –


Caution while using inline function

Use inline function when it is small enough to be defined in one or two lines .

Some scenarios where inline function may not work

1. If function contains a loop, a switch statement, or a goto statement.
2. If function contains static variable.
3. If function is recursive.

About WebRewrite

I am technology lover who loves to keep updated with latest technology. My interest field is Web Development.
Tagged , , , . Bookmark the permalink.