|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 |
#include<stdio.h>void
swap(int
*a,int
*b)//传地址相当于传了真值{ int
temp;//而传值在函数结束时销毁 temp=*a; *a=*b; *b=temp;}void
main(){ int
a=2,b=3; swap(&a,&b); printf("a=%d, b=%d",a,b);} |
原文:http://www.cnblogs.com/xzenith/p/3633435.html