CS Electrical And Electronics
@cselectricalandelectronics

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?
CS Electrical And Electronics Staff asked 4 years ago

info

1 Answers
CS Electrical And Electronics Staff answered 4 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.