/*
Name: WAP to swap two numbers using call by reference method
Author: Parveen Malik
Date: 23/09/11 11:43
*/
#include <stdio.h>
#include <conio.h>
void swap(int*,int*);
int main()
{
int x,y;
printf("Enter the value of x and y \n");
scanf("%d%d",&x,&y);
printf("Before swapping\nx = %d\ny = %d\n",x,y);
swap(&x,&y);
printf("After swapping\nx = %d\ny = %d",x,y);
getch();
return 0;
}
void swap (int *a, int *b)
{
int temp;
temp=*a;
*a=*b;
*b=temp;
}
OUTPUT :