title: Is it possible to 'walk through' the contents of struct?
body: <p>I've just started to use typedefs for the first time, and I haven't used structures a whole lot either, though I understand them very well.</p>
  
  <p>I've created a type call <code>Max7219_t</code> as follows:</p>
  
  <pre><code>typedef struct {
      uint16_t digit1,
      uint16_t digit2,
      uint16_t digit3,
      uint16_t digit4,
      uint16_t digit5,
      uint16_t digit6
      uint16_t digit7,
      uint16_t digit8,
      uint16_t intensity,
      uint16_t _shutdown,
      uint16_t scanl,
      uint16_t testmode,
      uint16_t decodetype } Max7219_t;
  </code></pre>
  
  <p>Later in the code, after I've declared a variable of this type and added values, I need to transfer each byte in the <code>struct</code> one at a time, ideally in a <code>for</code> loop.</p>
  
  <p>Is there any way to do this besides referring to each member directly (i.e., <code>*display-&gt;digit1</code>, then <code>*display-&gt;digit2</code> etcetera)? Essentially, is there a way to enumerate each entry the same way you'd do so with an array?</p>
  
  <p>I don't want to just convert the whole thing to an array, because I almost certainly will add different types to this and other structures later on during development.</p>
  
  <p>I feel like I'm missing something obvious here. I was thinking I could just increment a pointer, but because structure members aren't all the same size, I have a feeling this doesn't work like it does with pointers to arrays. Plus, when iterating through a <code>for</code> loop, I'm not sure if something like <code>for(q = 0; q != sizeof(Max7219_t); q++)</code> would work either.</p>
  
  <p>Any help is much appreciated!</p>