title: Why not incrementing z?
body: <p>I am trying to write a simple state machine executor in C. I have this code:</p>
  
  <pre><code>while(1) {  
    strcpy(fsm.state[x][z], lines[i]);
    printf("%i %i\n", x, z);
    z++; i++;
    if(strcmp(lines[i], ".") == 0) x++; z = 0;
    if(strcmp(lines[i], "") == 0) break;
  }
  </code></pre>
  
  <p>I don't understand why if <em>z</em> should only be reset when the current line I am reading from the <em>lines</em> array is equal to ".", which happens every third occurrence in my test scenario, that <em>z</em> stays equal to 0, even when <em>x</em> is successfully incremented every third line.</p>
  
  <p>I need output like so:</p>
  
  <blockquote>
    <p>1 0 \n 1 1 \n 1 2 \n 2 0 \n 2 1 \n 2 2 \n 3 0 \n 3 1 , etc...</p>
  </blockquote>
  
  <p>Instead I get:</p>
  
  <blockquote>
    <p>1 0 \n 1 0 \n 1 0 \n 2 0 \n 2 0 \n 2 0 \n 3 0 \n 3 0, etc...</p>
  </blockquote>
  
  <p>What do I have to change? This might be a stupid question, but I really don't understand what's wrong here.</p>
  
  <p>Thank you kindly for your help.</p>