下面程序的运行结果是 #include<iostream.h> void fun(int * a,int * b) { int x= * a; * a = * b; * b=x; cout

admin2010-06-06  18

问题 下面程序的运行结果是    #include<iostream.h>    void fun(int * a,int * b)    {         int x= * a;         * a = * b;  * b=x;         cout <<*a<<  *b<<"";    }    void main( 0    {          int x =1,y =2;         fun(&x,&y);         cout<< x << y <<end1;    }

选项 A、12  12
B、12  21
C、21  12
D、21  21

答案8

解析 本题考查的是指针和引用,函数 fun完成把x和y互换的操作。
转载请注明原文地址:https://kaotiyun.com/show/r0jp777K
0

最新回复(0)