#include <stdio.h> void swap(int *x, int *y) { int tmp = *x; *x = *y; *y = tmp; } int main(void) { int a = 1; int b = 2; printf("%d, %d\n", a, b); swap(&a, &b); printf("%d, %d\n", a, b); return 0; }
ʮΘΕํʯͰએݴ͢ΔݪଇΛࢥ͍ग़͢ ▸ *x[1]Ͱxͷ1൪ͷΞυϨεͷ த͕ಡΊΔ #include <stdio.h> int main(void) { int a = 0; int b = 1; int *x[2] = {&a, &b}; printf("%d, %d\n", *x[0], *x[1]); return 0; }