PROGRAM TO PERFORM CALL BY VALUE


Program to perform call by value:

Code:

#include<iostream.h>
#include<conio.h>
void exchange(int a,int b)
{
int c;
c=a;
a=b;
b=c;
}
void main()
{
clrscr();
int a,b;
cin>>a>>b;
cout<<"\t"<<"\nbefore function call\t";
cout<<a<<"\t"<<b;
exchange(a,b);
cout<<"\t"<<"\nafter function call\t";
cout<<a<<"\t"<<b;
getch();
}


Output:
 3 5
before function call 3 5
after function call 5 3



Comments

Popular posts from this blog

PROGRAM TO PERFORM CALL BY REFERENCE

PROGRAM TO PERFORM RRETURN BY REFERENCE