title: Implementing a for loop from an algorithm in c
body: <p>I am only learning c and I am trying to implement a for loop from an algorithm. I am so so confused in how to implement it, please see my attempt below. Any help or thoughts would be greatly appreciated as I am unsure, does it imply a loop within a loop. Or am I implementing the for loop correctly,</p>
  
  <p>The algorithm states For all possible a = (0,z0,z1,0)</p>
  
  <p>Looop From algorithm</p>
  
  <pre><code>   for (z0, z1) = (0x00, 0x00) to (0xff,0xff)
     h0 = somemethod( 0x02000000L ⊕ (0x00, z0,z1,0x00)) )
  </code></pre>
  
  <p>My Attempt     </p>
  
  <pre><code>  #define WORD32 unsigned int 
  
      for (BYTE z = 0x00; z &lt; 0xff; z++)
      {
          for (BYTE z1 = 0x00; z1 &lt; 0xff; z1++)
          {
              WORD32 a = (0 &lt;&lt; 24 | a1 &lt;&lt; 16 | z &lt;&lt; 8 | 0);
              WORD32 h0 = f(0x02000000L^a);
          }
      }      
  </code></pre>
  
  <p>So I unsure about the loop and is the below correct</p>
  
  <pre><code>        h0 = somemethod( 0x02000000L ⊕ (0x00, z0,z1,0x00)) )
  
          WORD32 a = (0 &lt;&lt; 24 | a1 &lt;&lt; 16 | z &lt;&lt; 8 | 0);
          WORD32 h0 = f(0x02000000L^a);
  </code></pre>
  
  <p>IE how i get</p>
  
  <pre><code> (0x00, z0,z1,0x00)
  </code></pre>
  
  <p><strong>Update</strong></p>
  
  <p>It is latter ordering: (0, 0), (0, 1), (1, 2), ..., (0, 255), (1, 0), …</p>
  
  <p>It means all possible combinations - the ordering does not matter once you go through them all.</p>