主页

GaHo Wong

关于函数参数传递常用的三种方式

值传递 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 void Exchg1(int x, int y) { int tmp; tmp = x; x = y; y = tmp; printf("x = %d, y = %d\n", x, y); } main() { int a = 4,b = 6; Exchg1(a, b); printf("a = %d, b = %d\n", a, b); return(0); } 输出结果: 1