title: Why are values being assigned to the next element in array
body: <p>I am using Visual Studio 12, and I created a very simple array of structures:</p>
  
  <pre><code>struct testFloatStruct {
     double A;
     double B;
  };
  struct testFloatStruct threeSetsOfFloats[4];
  </code></pre>
  
  <p>That creates a total of six values, and I have no trouble assigning a value to the very first of those six, namely, element [0].A</p>
  
  <p>However, when I assign a value to any of the others, the value <strong>following</strong> it is altered. For example, when I do this:</p>
  
  <pre><code>threeSetsOfFloats[0].B = 0.2;
  </code></pre>
  
  <p>The debugger shows that as soon as that statement is executed, the following element in he array, <strong>[1].A</strong>, picks up a bizarre value.</p>
  
  <p>I am not too familiar with Visual Studio since I was previously using the Borland compiler, so I don't know if I'm setting something wrong with the hundreds of compiler options.</p>
  
  <p>I simplified this test project to the point where it only has six assignment statements. I have two screen images and more information, along with a zip file of the project so that you can try it yourself:</p>
  
  <p><a href="http://www.hugequestions.com/c/Array_of_structures_problem.html" rel="nofollow">http://www.hugequestions.com/c/Array_of_structures_problem.html</a></p>