Google News
logo
CPP - Interview Questions
Define an Inline Function in C++? Write its syntax. Is it possible for the C++ compiler to ignore inlining?
In order to reduce the function call overhead, C++ offers inline functions. As the name suggests, an inline function is expanded in line when it is called.
 
As soon as the inline function is called, the whole code of the same gets either inserted or substituted at the particular point of the inline function call. The substitution is complete by the C++ compiler at compile time. Small inline functions might increase program efficiency.
 
The syntax of a typical inline function is :
Inline return-type function-name(parameters)
{
// Function code goes here
}
As the inlining is a request, not a command, the compiler can ignore it.
Advertisement