title: unnamed enum & typedef?
body: <p>I was getting a little confused with typedef/enum until I realised that I did not need to name the emun. Are there any differences / benefits between these two when used with typedef, the 2nd one to me seems a lot easier to understand.</p>
  
  <p>First Example:</p>
  
  <pre><code>typedef enum enumMenuItems {
      none,
      add,
      save,
      load,
      list,
      remove
  } menuItems;
  
  menuItems optionSelect = none;
  </code></pre>
  
  <p>Second Example:</p>
  
  <pre><code>typedef enum {
      Earth = 1, 
      Mars,
      Saturn,
      Neptune,
      Jupiter
  } planets;
  
  planets closest = Mars;
  </code></pre>
  
  <p>.</p>
  
  <h1>EDIT:</h1>
  
  <pre><code>typedef enum enumMenuItems {
      none,
      add,
      save,
      load,
      list,
      remove
  } menuItems;
  </code></pre>
  
  <p>So the above essentially defines two types, one an enum called enumMenuItems and the second a typedef of enumMenuItems called menuItems.</p>
  
  <pre><code>menuItems optionSelect = save;
  enum enumMenuItems optionSelect = save;
  </code></pre>
  
  <p>The above two declarations are essentially the same, one using the typedef and the other using the enum. So if your using a typedef you can leave your enum unnamed as the type can be accessed via the typedef menuItem.</p>
  
  <p>gary</p>