// call by reference in c++
#include<iostream.h>
#include<iostream.h>
#include<conio.h>
void
swap(int * ,int *);
void
main()
{
int a,b;
cout<<"Enter the value for
a and b: ";
cin>>a>>b;
swap(&a,&b);
cout<<"Values after
swapping A= "<<a<<" B= "<<b;
getch();
}
void
swap(int *p1,int *p2)
{
int t;
t=*p1;
*p1=*p2;
*p2=t;
}
C++ program to demonstrate call by reference |
1 comment:
CPP program to implement call by reference
Post a Comment