title: How to check if an enum variable is valid?
body: <p>I have an enum:</p>
  
  <pre><code>enum myenum{
    typeA,
    typeB,
    typeC
  } myenum_t;
  </code></pre>
  
  <p>Then, a functions is to be called with an enum parameter:</p>
  
  <pre><code>int myfunction(myenum_t param1)
  {
    switch(param1)
    {
      case typeA:
      case typeB:
      case typeC:
        //do the work
        break;
  
      default:
        printf("Invalid parameter");
    }
    return 0;
  }
  </code></pre>
  
  <p>But, as <code>myenum_t</code> grows with more and more values, <code>myfunction</code> doesn't seem so elegant.</p>
  
  <p>Is there a better way to check if an enum is valid or not?</p>