HOW TO CREATE A INLINE FUNCTION C PLUS PLUS?

Ashish Pandey

Total Post:128

Points:898
Posted by  Ashish Pandey
 931  View(s)
Ratings:
Rate this:
Hi Expert,

How to create a inline function c++? Can you provide me line of code.

Thanks in advance.
  1. AVADHESH PATEL

    Post:604

    Points:4228
    Re: How to create a inline function C plus plus?

    Try as following line of code:


    In line function is created with the help of inline specifier.
    e.g.-
    inline int even(int x)
    {
     return !(x%2);
    }
    int main( )
    {
     if(even(10)) cout<<"10 is even\n";
    if(even(11)) cout<<"11 is even \n";
    return 0;
    }

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!