swapping using pointers
#include<stdio.h>
int swap(int *a,int *b);
int main()
{
int x=4,y=5;
swap(&x,&y);
printf("after swapping:%d,%d",x,y);
return 0;
}
int swap(int *a,int *b)
{
int temp;
temp=*a;
*a=*b;
*b=temp;
}
#include<stdio.h>
Comments
Post a Comment