what is Inline function in c++? explain with example.

Inline function:-

C++ inline function is powerful concept that is commonly used with classes. If a function is inlined, the compiler places a copy of the code of that function at each point where the function is called at compile time.

To inline a function, place the keyword inline before the function name and define the function before any calls are made to the function. The compiler can ignore the inline qualifier in case defined function is more than a line.
inline int fun(int n)
return (n > 0 ? 1 :0);

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.