C File =>
/* Write a program to interchange two numbers using pointers.*/
#include<stdio.h>
int main ()
{
int a=5,b=8;
void swap(int *a,int *b)
{
int temp=0;
temp = *a;
*a=*b;
*b = temp;
}
printf("Before calling function:\n");
printf("a=%d and b=%d",a,b);
swap(&a,&b);
printf("\n After calling function:\n");
printf("a=%d and b=%d",a,b);
return 0;
}
Comments
Post a Comment
Please do not enter any spam link in message.