Advantages of inline functions.
A function when defined as INLINE, the code from the function definition is directly copied into the code of the calling function. A function is defined as inline using the 'inline' keyword as shown below :
inline float add(float i, float j) { return i + j};
Advantages : - It avoids the overhead of calling the actual function. This is because the complier performs and inline expansion which eliminates the time overhead when a function is called.
- It reduces space as no separate set of instructions in memory is written.
Advantages of inline functions.
- It relieves the burden involved in calling a function.
- It is used for functions that need fast execution.