title: Accessing enum Members in C
body: <p>I have a function that is of type of a struct, which contains some integers and a reference to an enum, as such:</p>
  
  <pre><code>typedef struct Test {
      Error e;
      int temp;
      int value;
  }Test;
  </code></pre>
  
  <p>Where the enum is:</p>
  
  <pre><code>typedef enum Error {
      IOError,
      ExternalError,
      ElseError,
  }Error;
  </code></pre>
  
  <p>And say I have a function that wants to return an error (Of an enum of the 3), depending on if something happens.</p>
  
  <p>Where the function is of type Test (I can't change any types or values passed in),</p>
  
  <p>Why can't I return the error like this? How would I go about returning it (I can't change the struct definitions nor the function prototypes).</p>
  
  <pre><code>Test errorFunc() {
  
      return Test-&gt;e-&gt;IOError; //gives an error
  }
  </code></pre>
  
  <p>Any help would be greatly appreciated!</p>