int a=10;f1(){int a=20;printf("%d",a);}f2(){printf("%d",a);}main ( ){int a=30;f1();f2(); printf(a)int a=10;f1(){int a=20;printf("%d",a);}f2(){printf("%d",a);}main ( ){int a=30;f1();f2();printf("%d",a);}答案是 20 10 30求解答.

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/13 04:16:43

int a=10;f1(){int a=20;printf("%d",a);}f2(){printf("%d",a);}main ( ){int a=30;f1();f2(); printf(a)int a=10;f1(){int a=20;printf("%d",a);}f2(){printf("%d",a);}main ( ){int a=30;f1();f2();printf("%d",a);}答案是 20 10 30求解答.
int a=10;f1(){int a=20;printf("%d",a);}f2(){printf("%d",a);}main ( ){int a=30;f1();f2(); printf(a)
int a=10;f1(){int a=20;printf("%d",a);}f2(){printf("%d",a);}main ( ){int a=30;f1();f2();
printf("%d",a);}答案是 20 10 30求解答.

int a=10;f1(){int a=20;printf("%d",a);}f2(){printf("%d",a);}main ( ){int a=30;f1();f2(); printf(a)int a=10;f1(){int a=20;printf("%d",a);}f2(){printf("%d",a);}main ( ){int a=30;f1();f2();printf("%d",a);}答案是 20 10 30求解答.
mai函数是程序执行的第一步 ,首先看main方法,它执行的顺序是:调用f1方法,调用f2方法,打印a.f1中a被重新定义为20,f2中a没有被赋值,还是10,最后打印a,但这时a被定义为30,所以输出30.最后输出20,10,30.第一个a值是10,在方法外定义的,叫全局变量,方法里面定义的叫局部变量,局部变量可以取代全局变量的值.