title: How are struct members allocated in memory?
body: <p>While attempting to create a memory manager for future C programs, I've come across this question:</p>
  <h3><em>&quot;when structs are allocated, are their member fields stored in the order specified?&quot;</em></h3>
  <p>For instance, consider the following struct.</p>
  <pre><code>typedef struct {
      int field1;
      int field2;
      char field3;
  } SomeType;
  </code></pre>
  <p>When allocated, will the memory addresses of the fields be in the order field1, field2, field3? Or is this not guaranteed?</p>