title: Print enum mapping mapping in C
body: <p>I frequently use <code>enum</code> in C to access array elemnets with numerical data, e.g.</p>
  
  <pre><code>#define KEYS_MAX 1
  #define FIELD_MAX 2
  
  enum {FIELD1=0, FIELD2};
  
  double array[KEYS_MAX][FIELD_MAX];
  array[1][FIELD1] = 1.0; array[1][FIELD2] = 2.0;
  </code></pre>
  
  <p>I then print the data to a file in <code>KEYS_MAX</code> lines and <code>FIELD_MAX</code> columns. To know later the  content of the columns I would like to print a header line.</p>
  
  <pre><code># KEY FIELD1 FIELD2
  1 1.0 2.0
  </code></pre>
  
  <p>I would like to have a routine which does this during runtime correctly even if I update the  code by changing only <code>enum</code>. I.e., how can I print the header line using C-code and possibly macros using a fixed routine independent of updates of <code>enum</code>?</p>
  
  <p>I found this: <a href="https://stackoverflow.com/questions/1884229/mapping-enum-values-to-strings-in-c">Mapping enum values to strings in C++</a> , but I would prefer something which would also work with the intel compiler.</p>