
#include<stdio.h>
#include<conio.h>
int main()
{
int a,b;
printf("Enter value of a:");
scanf("%d",&a);
printf("\nEnter value of b:");
scanf("%d",&b);
printf("Before swapping\n");
printf("a=%d\n",a);
printf("b=%d\n",b);
swap(&a,&b);
printf("After swapping\n");
printf("a=%d\n",a);
printf("b=%d\n",b);
getch();
return 0;
}
int swap(int *a,int *b)
{
int temp;
temp=*a;
*a=*b;
*b=temp;
return 0;
}
0 comments:
Post a Comment