SWAPPING TWO NUMBERS USING CALL BY REFERENCE


LIST OF PROGRAMS


#include<stdio.h>
#include<conio.h>
void swap(int *m,int *n);
void main()
{
int x=10,y=20,*m,*n;
m=&x;
n=&y;
clrscr();
printf("%d %d\n",x,y);
swap(m,n);
printf("%d %d",x,y);
getch();
}
void swap(int *m,int *n)
{
int l;
l=*m;
*m=*n;
*n=l;
}

LIST OF PROGRAMS


Comments