title: C enum tags: When/Why to Use
body: <p>I'm trying to understand the full syntax of a C enum.  For decades, I've successfully used simple enums like the below:</p>
  
  <pre><code>enum {
    IDLE,
    BUSY,
    FAILED
  };
  </code></pre>
  
  <p>But I see the formal definition of a C enum also allows a tag and instance name like the below:</p>
  
  <pre><code>enum STATE {
    IDLE,
    BUSY,
    FAILED
  } appstate;
  </code></pre>
  
  <p>When and why would I ever use <strong>"STATE"</strong> or <strong>"appstate"</strong>? For the life of me I can't think of a reason.</p>
  
  <p>Questions <a href="https://stackoverflow.com/questions/8414188">8414188</a> and <a href="https://stackoverflow.com/questions/7386805">7386805</a> beat around the bush on this issue but were not enlightening.</p>
  
  <p><strong>UPDATE 5/4/19</strong><br>
  I offer some clarifications to my question in response to answers per below:<br>
  1. I <em>do</em> use prefixes, e.g. STATE_IDLE, but theses were trimmed in my bare-bones examples above.
  2. I <em>have</em> examined several code examples using enums. These confirmed my understanding of the enhanced syntax but did nothing to explain <em>why</em>.<br>
  3. I routinely place my anonymous enum in a project-wide .h file, and this seems to work just fine. I still can't figure out <em>why</em> I would want to waste keystrokes to use the politically-correct, enhanced syntax. <strong>Is it just for (allegedly) improved readability?</strong> Or am I missing something?</p>