Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

There is no compilation error when attempting to loop through an enumerated type in C using a for loop. However, it is not the recommended way to iterate over an enumerated type because it can cause problems if additional values are added to the enumerated type in the future. It is better to use a switch statement to handle each value of the enumerated type separately.