正在加载图片...
The c Programming language Chapter8 Functions Exp: exchange two numbers /*ch72c* ginnings X #include <stdio. h> ma X y {intx-7,y=11; calling: printf("x%d, ty=%, x,y) a b printf("swapped: n") swap(x,y) swap y printf("x=%d, ty=%dn, y) Swal ap(int a, int b) Int temp temp temp=a;a=b; b=temp finishThe C Programming Language Chapter 8 Functions beginning: x: 7 y: 11 finish: x: 7 y: 11 Exp: exchange two numbers /*ch7_2.c*/ #include <stdio.h> main() { int x=7,y=11; printf("x=%d,\ty=%d\n",x,y); printf("swapped:\n"); swap(x,y); printf("x=%d,\ty=%d\n",x,y); } swap(int a,int b) { int temp; temp=a; a=b; b=temp; } calling: a: 7 b: 11 x: 7 y: 11 swap: x: 7 y: 11 a: 11 b: 7 temp
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有