title: while loop nested in a while loop
body: <p>I was using a nested while loop, and ran into a problem, as the inner loop is only run once.
  To demonstrate I've made a bit of test code.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  int main(){
    int i = 0;
    int j = 0;
    while(i &lt; 10){
      printf("i:%d\n", i);
      while(j &lt; 10){
        printf("j:%d\n", j);
        j++;
      }
    i++;
    }
  }
  </code></pre>
  
  <p>This returns:</p>
  
  <pre><code>i:0
  j:0
  j:1
  j:2
  j:3
  j:4
  j:5
  j:6
  j:7
  j:8
  j:9
  i:1
  i:2
  i:3
  i:4
  i:5
  i:6
  i:7
  i:8
  i:9
  </code></pre>
  
  <p>Can anyone explain why the nested loop doesn't execute 10 times? And what can I do to fix it?</p>