Write A Program of Call by Reference
Write A Program of Call by Reference
#include<stdio.h>
#include<conio.h>
void main()
{
void swap(int*a,int*b);
int a,b;
printf(enter any two numbers);
scanf(%d%d,&a,&b);
printf(before swapping a=%d,b=%d,a,b);
swap(&a,&b);
printf(after swapping a =%d, b=%d,a,b);
getch();
}
void swap(int*x,int*y)
{
int z;
z=*x;
*x=*y;
*y=*z;
}
OUTPUT
enter any two numbers 6 7
before swapping a=6 b=7
after swapping a=7 b=6