Why do C enumeration constants need a name? -


Why does the counting constant need a name? Because it:

  #include & lt; Stdio.h & gt; Nim {n, yes}; Int main (zero) {printf ("% d \ n", yes); }  

works like this:

  #include & lt; Stdio.h & gt; Enum boolean {No, yes}; Int main (zero) {printf ("% d \ n", yes); }  

If you want to create a type of 'enum', then That:

  value boolean x; X = No;  

An easy way to do this is with a type-tof:

  typingfum enum {NO, YES} boolean;  

And then you only need to use as a type of boolean:

  boolean x; X = No;  

Comments

Popular posts from this blog

Is there an open source WebSockets (JavaScript) XMPP library? -

java - Is there an object like a "Set" that can contain only unique string values, but also contain a count on the number of occurrences of the string value? -

iphone - How do I make a UIPickerView in a UIActionSheet -