填空题
有下面的程序:
#include <stdio, h>
main ( )
enum team my,your=4,his,her=his+10;
prinff(" % d %d %d %d //n" ,my,your,his,her);
此程序的输出结果是{{U}} {{/U}}。
A) 0 1 2 3 B) 0 4 0 1 0 C) 0 4 5 1 5 D) 1 4 5 1 5
【正确答案】
1、C
【答案解析】[解析] 枚举的语法规定,当枚举元素没有赋值时,如果前面没有其他枚举元素,其值为0;如果前面有其他枚举元素,其值为前一个元素的值加1,所以his的值为5,her的值为15。