struct ty { int data;;char c;}; main(){struct ty a={30.'x'}; fun(a); printf("%d%c",a.data,a.c):}fun(struct ty b) { b.data=20;b.c='y'}

来源:学生作业帮助网 编辑:作业帮 时间:2024/04/29 15:40:20

struct ty { int data;;char c;}; main(){struct ty a={30.'x'}; fun(a); printf("%d%c",a.data,a.c):}fun(struct ty b) { b.data=20;b.c='y'}
struct ty { int data;;char c;}; main(){struct ty a={30.'x'}; fun(a); printf("%d%c",a.data,a.c):}
fun(struct ty b) { b.data=20;b.c='y'}

struct ty { int data;;char c;}; main(){struct ty a={30.'x'}; fun(a); printf("%d%c",a.data,a.c):}fun(struct ty b) { b.data=20;b.c='y'}
打印的是30x,因为调用函数f并无改变a的值,只是改变形参b的值,函数结束后b被销毁