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.
Loading...
Related Quiz
- The ________ loop guarantees at least one execution of the loop body, even if the condition is false from the start.
- The ______ function in C can be used to change the position of the file pointer in a stream.
- In a program that processes large datasets, you notice that reading the data from a file is a performance bottleneck. Which file handling functions could help improve the performance?
- In C, using pointers to structures can lead to more efficient memory usage because it allows for ________ allocation and deallocation of memory.
- What is the lifetime of a static variable in a C program?