Why might you choose to use an enumeration instead of a series of #define statements for constants?

  • #define statements are faster to evaluate
  • Enumerations are more memory-efficient
  • Enumerations cannot be used for constants
  • Enumerations provide type checking
You might choose to use an enumeration instead of a series of #define statements for constants because enumerations provide type checking, making your code more robust and error-prone. #define statements are simple text replacements and do not offer type safety.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *