选c????为什么不选a
来源:学生作业帮 编辑:大师作文网作业帮 分类:综合作业 时间:2024/11/17 14:00:41
选c????为什么不选a
int num ( )
{ extern int x, y;
int a = 15, b = 10;
x = a – b; y = a + b; return;
}
main ( )
{ int a = 7, b = 5;
x = a + b; y = a – b;
num ( );
printf ("%d %d\n", x, y );
}
A. 12, 2 B.不确定
C. 5, 25 D.2, 12
int num ( )
{ extern int x, y;
int a = 15, b = 10;
x = a – b; y = a + b; return;
}
main ( )
{ int a = 7, b = 5;
x = a + b; y = a – b;
num ( );
printf ("%d %d\n", x, y );
}
A. 12, 2 B.不确定
C. 5, 25 D.2, 12
num中定义x,y是全局变量,extern变量优先级高,覆盖掉main临时变量x,y。