单选题
有以下程序:
#include
int a=1,b=2;
void funl(int a,int b)
{
printf(“%d%d”,a,b);
}
void flun2()
{
a=3;b=4;
}
main()
{
funl(5,6);fun2();
printf(“%d%d\n”,a,b);
}
程序运行后的输出结果是( )。
【正确答案】
A
【答案解析】解析:在一个源文件中,如果外部变量和局部变量同名,则在该局部变量的作用域内,该外部变量会被“屏蔽”,所以函数funl()输出的是局部变量a、b的值:5 6;fun2()改变的是全局变量a、b的值,输出结果为3 4,答案选A。