title: How do I call a variable based on the value of i in the for loop
body: <p>Let's say I have a variable called L0 , L1 , L2 .... L9</p>
  <p>How do I make it so that I can call and increment one of these variables based on the value of the integer &quot;i&quot; on this for loop?</p>
  <pre><code>for(int i = 0; i &lt; 10; i++)
  </code></pre>
  <p>My idea is to use an if statement or to use a switch, but it would greatly affect the time complexity if I were to call it multiple times.</p>
  <p>I tried to make a simple example of what I'm trying to do below:</p>
  <pre><code>for(int i = 0; i &lt; 10; i++){
  
  ++(L+i) // (if i = 0 -&gt; ++L0, if i = 1 -&gt; ++L1, etc)
  
  }
  
  </code></pre>