need clarification

0 votes
asked Feb 15, 2018 by anonymous
main()
{
enum _tag{ left=10, right, front=100, back};
printf("%d, %d, %d, %d", left, right, front, back);
}

1 Answer

0 votes
answered Feb 16, 2018 by anonymous
If enum constant isn't assigned value explicitly,  it will add 1 to last set enum constant and assign to current constant. Thats why right=11 and back=101.
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...