Inline Function In cpp

Inline Function In cpp

PROGRAM:

#include<iostream>
#include<stdio.h>
using namespace std;
inline int addition(int a,int b){
        return (a+b);
}
int main(){
int x,y,add;
char ch;
do{
cout<<"Enter NUM1 & NUM2 : ";
cin>>x>>y;
add=addition(x,y);//!the compiler places a copy of the code here
cout<<"\nNUM1 + NUM2 : "<<add;
cout<<"\n\t\t\t Enter y to continue : ";
cin>>ch;
}while(ch=='y');
return 0;
}

 
 

Comments

Popular posts from this blog

Introduction to ChatGPT: Explain what ChatGPT is, how it works, and what it is used for.

Multi Level Inheritance In cpp