title: For loop for Arrays - Adding from previous value
body: <p>I have the following code from Programming with c from Koshar. I did understand how it works, i just don't get where in the for loop will grab the previous value. The expected result I pasted it under the code for organization purposes. </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int main(void) {
  int number [10] = {1, 0, 0, 0, 0, 0, 0, 0, 0, 0};
      int i, j;
  
      for( j = 0; j &lt; 10; ++j)
          for (i = 0; i &lt; j; ++i)
              number[j] += number[i];
  
      for (j = 0; j &lt; 10; ++j)
          printf ("%i ", number [j]);
  
          printf("\n");
  
          return 0;
  }
  </code></pre>
  
  <p>OUTPUT</p>
  
  <blockquote>
    <p>1 1 2 4 8 16 32 64 128 256 </p>
  </blockquote>