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
Post a Comment