title: C programming constantly updating variable in for loop
body: <p>I am learning to code and I face an issue regarding undeclared variables in the for loop. Any feedback or suggestions will be greatly appreciated.</p>
  <p>I have provided a T and an R value as shown in the code below. However, by trying to add a for loop, the variable becomes undeclared. I would like to compare the value of T0 T1 T2 to T7 using a for loop with the Ti variable. How do I include the Ti variable so that the i constantly change according to the for loop?</p>
  <pre><code>int T0=0, T1=1, T2=1, T3=0, T4=0, T5=1, T6=1, T7=0;
  
  int R0=0, R1=0, R2=1, R3=0, R4=1, R5=1, R6=0, R7=0;
  
  int j=0;
  int r;
  
  for (int i=0; i&lt;8; i++)
  {
      if (Ti==1)
      {
          r = Ri;
          j++;
      }
      else
          i++;
  
     printf(&quot;The output for r is %d&quot;, r);
  }
  </code></pre>