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

Discussion

Choose the correct answer

  • A.Enum variables can not be assigned new values
  • B.Enum variables can be compared
  • C.Enumeration feature increase the power of C
  • D.All of above

Answer: C

Correct answer: Enumeration feature increase the power of C

Enumerations add expressive power: they let a set of related integer constants be given a named type, so the intent is visible in the source, the values appear symbolically in a debugger, and the compiler can warn where a switch fails to handle every enumerator.

The other statements are false as written. Enum variables are ordinary integer objects - they can be assigned new values and compared freely, and C does not restrict them to their declared enumerators. That looseness is the price of the compatibility C keeps with plain integers.

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

Post your comment

Please log in or register to post a comment.