0

Write a c program for swaping of two numbers

19th Feb 2017, 3:35 AM
Tejasri Sunkara
Tejasri Sunkara - avatar
2 Answers
+ 1
void swap(int *x,int *y) { int temp=*x; *x=*y; *y=temp; } This code snippet swaps the address of the two variables
19th Feb 2017, 6:18 AM
satyam
satyam - avatar
0
#include <stdio.h> int main() { int x, y, temp;   printf("Enter the value of x and y\n"); scanf("%d%d", &x, &y);     temp = x; x = y; y = temp; printf("After Swapping \n x = %d \n y = %d \n",x,y);   return 0; }
19th Feb 2017, 4:18 AM
Chintan Maisuriya
Chintan Maisuriya - avatar