title: Does a variable initialized in a for loop get reset every iteration?
body: <pre><code>for (i=0;i&lt;=n;i++) {
         fsten[i]=fx(xsten[i]); //fsten[0] = fx(xsten[0]); fsten[1] = fx(xsten[1]); ...; etc. initializing the fsten array up to n times.
  } //end of initial for loop
  
        y=0.0;
  
        for (i=0;i&lt;=n;i++) {
         L=1.0; //the lagrange basis polynomial
             for (j=0;j&lt;=n;j++) {
                  if (i!=j) {
                   L=L*(x-xsten[j])/(xsten[i]-xsten[j]);
                  } //end of if statement
             } //end of second for loop
         y=y+fsten[i]*L;
        }//end of first for loop
  </code></pre>
  
  <p>I am doing a Lagrange polynomial iteration. We are looking at the second for loop after the y=0.0. At the end of the for loop with the <code>j=0</code>, we have <code>y = y+fsten[i]*L</code> where L is obviously not <code>1</code> anymore. But when it goes to <code>i=1</code> does that mean that the L=1.0 is true again?</p>