Possible duplicate:looping enumeration values
Suppose we are dealing with a deck of cards
typedef enum { HEARTS, CLUBS, DIAMONDS, SPADES, SUIT_NOT_DEFINED } Suit;
How can I list the listing?
You can use the lower bound of enum as the starting point and check that the loop condition is against the upper bound:
enum
for(int i = HEARTS; i < SUIT_NOT_DEFINED; ++i) { //do something with i... }
Source: https://habr.com/ru/post/903159/More articles:Android: using FEATURE_NO_TITLE with a custom ViewGroup leaves space on top of the window - androidMatching accuracy of search words, possibly using Levenshtein distance - matchingWhy might this particular test be useful? - c #PostgreSQL 9.1 installation and database encoding - installationC ++ remove spaces - c ++Obtaining authentication to send email to find the password - ruby-on-railsCreate this effect on mobile safari? - javascript"Split" one request into multiple servers - httpHow to cancel server geocoding using python, json and google maps? - pythonHow can I save objects on release when using Objective-C ARC with Xcode 4.2? - memory-managementAll Articles