ProAnswers.org

what is inline function?

1 Like

inline is a hint to the compiler to replace the function call with the code in the function
eg:
If the compiler inlines the function -It may not do so- this code:

inline void f()
{
std::cout << “Foo Bar”;
}

int main()
{
f();
return 0;
}

would give the same result as

int main()
{
std::cout << “Foo Bar”; // what was in the function is where the function was called
return 0;
}