Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.
Every time a function is called it takes a lot of extra time in executing a series of instructions for tasks such as jumping to the function, saving registers, pushing arguments into stack and returning to the calling function.
Solution to this problem is:
A) Macro
the drawback with macro is that they are not really functions and therefore, the usual error checking does not occur during compilation.To define preprocessor macros we can use #define. Its syntax is:
#define identifier replacement
When the preprocessor encounters this directive, it replaces any occurrence of identifier in the rest of the code byreplacement. This replacement can be an expression, a statement, a block or simply anything.
B) Inline function
it is a function that is expanded in line when it is invoked. That is, the compiler replaces the function call with the corresponding function code. All inline functions must be defined before they are called. The functions are made inline when they are small enough to be defined in one or two lines.
The inline functions are defined as:
Inline function-header{
function-body
}
Where Inline is a keyword.
For detail information can refer: https://garimacoder.wordpress.com/2014/02/15/inline-functions-in-c