title: Get the index of an element declared in a struct
body: <p>I'd like to associate each element of my struct (or something else, may not be possible with a struct) with an incrementing index, kind of like an enum but associate with value fields.
  Let's say that I have this data struct :</p>
  <pre><code>typedef struct
  {
      int8_t value_at_index0; // start with index 0 for this field
      int8_t value_at_index1; // then index = 1, etc
      int8_t value_at_index2;
      int8_t value_at_index3;
      int8_t value_at_index4;
  } data;
  </code></pre>
  <p>I want to get the index of a field, and the index should mirror the position where the field was declared in the struct.</p>
  <p>EDIT: My problem is that I want to write values in an external memory, but I don't want to figure at which index is the value. For example I'd like to do that: <code>write(index.value_at_index2, data.value_at_index2)</code></p>
  <p>Thanks</p>