Inline Functions

Inline functions :

Inline functions are the one in which compiler copies the code in function body, at the address where the function was  called. Functions are made inline by using inline keyword during function definition.

inline return_type function name(parameters)

{

..

….

}

Instead of transferring control to and from the function body, a modified copy of its body is substituted directly at the function call statement. In this way, the performance overhead of a function call is avoided.

Inline function speed sup the execution of the program. Like in sorting algorithms, swap of a no. done by an inline function saves a lot of time by copying the code at function call statement.

e.g.

Leave a Reply

Your email address will not be published. Required fields are marked *