#include <stdio.h>
void swap(int *a, int *b) { int temp = *a; *a = *b; *b = temp; } int main() { int a, b; printf("a : "); scanf("%d", &a); printf("b : "); scanf("%d", &b); printf("\n\n(before) a = %d\n(before) b = %d\n\n", a, b); swap(&a, &b); printf("swapped!\n\n"); printf("(after) a = %d\n(after) b = %d\n", a, b); return 0; }
|