#include<conio.h>
int main()
{
// Declaring variable a, b for two values
int a,b;
// Inputing values
printf("Enter first value a : ");
scanf("%d",&a);
printf("Enter second value b : ");
scanf("%d",&b);
// Printing original value
printf("Original value : a = %d, b = %d\n",a, b);
// Calling function interchange
interchange(&a, &b);
getch();
return 0;
}
void interchange(int *x, int *y)
{
int swap;
// Interchanging value
swap=*x;
*x=*y;
*y=swap;
// Printing interchanged value
printf("Interchanged value : a = %d, b = %d ",*x, *y);
}
No comments:
Post a Comment