首页 > 试题广场 >

#include void fun(...

[填空题]
#include <iostream.h>
void fun(int *a, int *b) {
    int *k;
    k = a;
    a = b;
    b = k;
}
void main( ) {
    int a = 3, b = 6, *x = &a, *y = &b;
    fun(x, y);
    cout << "No.1:" << a << "," << b << " ";
    fun(&a, &b);
    cout << "No.2:" << a << "," << b << endl;
}

输出:1
应该都只交换了一下地址
发表于 2019-10-18 09:15:11 回复(0)