|
阅读以下C代码, 回答问题1和问题2,将解答写在答题纸的对应栏内。
【C代码1】
typedef enum{RED=0,BLUE,YELLCW· COLOR;
int main () {
COLOR color= RED;
switch(++color) {
case RED: printf ( ” red\n” );
case BLUE: pri口tf ( ” blue\n” );
case YELLOW: printf ( ” ylllow \n” ) ; break;
default: printf ( ”’ error \n” );
﹜
return 0;
﹜
|
|
问题:2.1
(6分)
(1)对于代码1中定义的枚举类型COLOR,请给出枚举符BLUE和YELLOW的值。
(2)请写出代码1运行时的输出结果。
|
|
问题:2.2
(9分)
(1)请写出代码2运行时的输出结果。
(2)将代码2中数组a的定义修改为“ int a[6] = {85, 40 , 73, 16}; ” 后再编译运行,请写出对应的输出结果。
|
|
|
|