Hızlı yanıt: kod örneği
stackoverflow.com how-can-i-define-an-enumerated-type-enum-in-c
It's worth pointing out that you don't need a . You can just do it like the followingIt's a style question whether you prefer . Without it, if you want to refer to the enumeration type, you need to use . With it, you can just say .Both ways have their pro and cons. The one is more wordy, but keeps type identifiers into the tag-namespace where they won't conflict with ordinary identifiers (think of and the function: these don't conflict either), and where you immediately see that it's a type. The other is shorter, but brings type identifiers into the ordinary namespace.
typedef
enum strategy { RANDOM, IMMEDIATE, SEARCH };enum strategy my_strategy = IMMEDIATE;
typedef
enum strategy
strategy
struct stat
stat