编辑代码

#include<stdio.h>

void test(int & x){     //&添加引用符才能调用,c++才有
    x = 1024;
    printf("test函数内部 x=%d\n",x);
}

int main(){
    int x = 1;
    printf("调用test前 x=%d\n",x);
    test(x);
    printf("调用test后 x=%d\n",x);
}