Learning  C++
Home
Tutorials
C++  Programs
Contact  us
Sitemap
Your Ad Here
Your Ad Here
// Example program for call by value


#include<iostream.h>
void change(int,int);
int main()
{
     int a,b;
     cout<<"Enter values for a and b \n";
     cin>>a>>b;
     change(a,b);
     cout<<"\n The values of a and b after executing the function  :";
     cout<<a<<" "<<b;
     return 0 ;
}


void change(int c, int d)
{

     c=c*10;
     d=d+8;
     cout<<"\n The values of a and b inside the function : "<<c<<" "<<d;
}


Test data

Enter values for a and b
2  3

Output
The values of a and b inside the function : 20  11
The values of a and b after executing the function : 2  3