title: Static enum usage in c
body: <p>I have searched the static usage on enums in c and then I am posting this topic here. I am a tester and I need to test the <strong>enum datatype for local,static ,global scope</strong> by writing a simple program. </p>
  
  <p>A simple static variable can be tested easily, similarly <strong>I need to test static enum datatype.</strong> </p>
  
  <p>I have written a simple code. Need your help guys.</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  
  enum day {sun=1,mon,tue,wed,thur,fri,sat};
  static enum direction {UP,DOWN,RIGHT,LEFT};
  
  int static_enum()
  {
      static enum direction dir = UP;
      printf("dir = %d\n",dir);
      dir++;
  }
  
  
  int main()
  {
      printf("\nsun = %d mon = %d tue = %d wed = %d thurs = %d fri = %d sat = %d\n",sun,mon,tue,wed,thur,fri,sat);
      enum day fri = 25;
      // now friday gets modified from 21 to 25 becasue we have re-assigned the value
      printf("\nfri = %d\n",fri);
      // now saturday will still have value 22
      printf("\nsat = %d\n",sat);
      printf("\n"); 
      static_enum();
      static_enum();
          return 0;
  }
  </code></pre>
  
  <p>Let me know if the code tests the static functionality of enum data type.
  Thank you </p>
  
  <p>Note : the topics I searched landed me in either C# or java. </p>