Home > DeveloperSection > Forums > How to create a inline function C plus plus?
Ashish Pandey

Total Post:128

Points:898
Posted on    June-14-2013 9:37 AM

 Visual C++ Visual C++ 
Ratings:


 1 Reply(s)
 674  View(s)
Rate this:
Hi Expert,

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

Thanks in advance.


AVADHESH PATEL

Total Post:604

Points:4228
Posted on    June-15-2013 4:52 AM

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;
}

Don't want to miss updates? Please click the below button!

Follow MindStick