title: Change variable at array index, not the actual list
body: <p>Somewhere in my code I have the following:</p>
  
  <pre><code>_buttonStates[0] = _upButtonState; _buttonStates[1] = _leftButtonState;
  </code></pre>
  
  <p>is there a way to do this:</p>
  
  <pre><code>buttonStates[0] = true;
  </code></pre>
  
  <p>changing the variable _upButtonStates, instead of replacing it with the value 'true'?</p>
  
  <p>I am doing the following:</p>
  
  <pre><code>  for(int i = 0; i &lt; sizeof(_buttons)/sizeof(_buttons[0]); i++){
       if(_buttonStates[i] != digitalRead(_buttons[i])){
          _stateChanged[i] = true;
          _buttonStates[i] = digitalRead(_buttons[i]);
       }
       else{
          _stateChanged[i] = false;
       }
  </code></pre>
  
  <p>But later references to '_upButtonState' end up being outdated.</p>
  
  <p>How do I change the value of a variable in the list instead of overwriting it when accessing it via its index?</p>