Machine-translated by Google. Questions are authored in English.
Top

Discussion

Pick the incorrect statement with respect to enums.

  • A.Two enum symbols cannot have the same value
  • B.Only integer constants are allowed in enums
  • C.It is not possible to change the value of enum symbols
  • D.Enum variables are automatically assigned values if no value is specified

Answer: A

Correct answer: Two enum symbols cannot have the same value

The false statement is that two enumerators cannot share a value: they can. enum {a = 1, b = 1}; is perfectly legal, and it is sometimes useful for giving one constant two names. The other three are true: enumerator values must be integer constant expressions, they cannot be assigned to at run time, and any you leave unspecified are filled in automatically, continuing from the last value given.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.