main() { enum team {my,your=4,his,her=his+10}; printf("%d %d %d %d\n",my,your,his,her);}
问题描述:
main() { enum team {my,your=4,his,her=his+10}; printf("%d %d %d %d\n",my,your,his,her);}
main()
{ enum team {my,your=4,his,her=his+10};
printf("%d %d %d %d\n",my,your,his,her);}
答案为什么是 0 4 5 15
答
my = 0 ( 默认 )
your = 4 (你设定)
his = your + 1 ( your 的下一个,默认+1)
her = his + 10 ( 自然是 5 + 10 = 15 )