Write a Cpp code to add two numbers using inline function?

All QuestionsCategory: Cpp LanguageWrite a Cpp code to add two numbers using inline function?
Chetan Shidling Staff asked 5 years ago

info

1 Answers
Chetan Shidling Staff answered 5 years ago

Code:

//INLINE FUNCTION
#include <iostream>
using namespace std;
inline int add(int a,int b)
{
return(a+b);
}
int main()
{
int x = 10,y = 10;
cout<<“Sum is :”<<add(x,y)<<endl;
return 0;
}

Output:

Sum is :20
Process returned 0 (0x0) execution time : 0.119 s
Press any key to continue.