case001:Learning C Language......
时间:2011-03-12 来源:tianzhanfei
learning c language,1 lesson per day,keep on,do more practise.
origin:
#include <stdio.h> main() { int a,b; a=2;b=5; swap(a,b); printf("a=%d,b+%d\n",a,b); } swap(x,y) int x,y; { int t; t=x; x=y; y=t; printf("x=%d,y=%d\n",x,y); }
finished
#include <stdio.h> void swap(int x, int y); //先声明 int main() //main() { int a,b; a=2;b=5; swap(a,b); printf("a=%d,b=%d\n",a,b);//printf("a=%d,b+%d\n",a,b); return 0; } /* swap(x,y) int x,y; 这是古老的函数定义方式 */ void swap(int x, int y) { int t; t=x; x=y; y=t; printf("x=%d,y=%d\n",x,y); }
相关阅读 更多 +