title: Access speed: local variable vs. array
body: <p>Given this example code:</p>
  
  <pre><code>struct myStruct1 { int one, two; } first; 
  struct myStruct2 { myStruct1 n; int c; } second[255];
  
  // this is a member of a structure in an array of structures! 
  register int i = second[2].n.one; 
  const int u = second[3].n.one; 
  
  while (1)
  {
    // do something with second[1].n.one
  
    // do something with i
  
    // do something with u
  }
  </code></pre>
  
  <p>Which one is faster?  </p>
  
  <p>Is it correct that a local copy of an array index can be copied into a register?  </p>
  
  <p>Will it be even faster if the copy is done inside the loop?</p>