Program for Passby Value-PARAMETER PASSING
#include<iostream.h>
#include<conio.h>
void swap(int,int);
void main()
{
int a,b;
cout<<"Enter any two numbers";
cin>>a>>b;
swap(a,b);
cout<<"\n the swapped valuesin the main funtion are"<<a<<"and"<<b;
getche();
}
void swap(int x,int y)
{
int t;
t=x;
x=y;
y=t;
cout<<"\n the swapped values in the function are"<<x<<"and"<<y;
}
0 comments
Post a Comment