title: C - Multiple Bar Sliders
body: <p>I have a program which has multiple sliders than can be controlled using the 
  A and D Keys to Increase/Decrease the value, and W and S to Choose which Bar to control. Everything works, changing values and even controlling different sliders, but I can't change which slider to control. I have a variable named "BarChosen" which is used to use the array of whatever Bar it is on, so if BarChosen = 0 then you can control Bar 0.</p>
  
  <p>To Print The Bars</p>
  
  <pre><code>void BarValues(int Bar, int BarLeft,char UserInput) {
  for (int i = 0; i &lt; Bar; i++) {
      printf("|");
  }
  
  for (int i = 0; i &lt; BarLeft; i++) {
      printf(".");
  }
  
  printf(" - %d\n", Bar);
  
  }
  </code></pre>
  
  <p>To Control</p>
  
  <pre><code>void UpdateBar(char UserInput,int BarChosen,int Bar[3], int BarLeft[3]) {
  if (UserInput == 'a' || UserInput == 'A') {
      if (Bar[BarChosen] &lt;= 0) {
  
      }
      else {
          Bar[BarChosen]--;
          BarLeft[BarChosen]++;
      }
  }
  
  else if (UserInput == 'd' || UserInput == 'D') {
      if (Bar[BarChosen] &gt;= 30) {
  
      }
      else {
          Bar[BarChosen]++;
          BarLeft[BarChosen]--;
      }
  }
  
  else if (UserInput == 'w' || UserInput == 'W') {
      if (BarChosen &lt;= 0) {
  
      }
      else {
          BarChosen--;
      }
  
  }
  
  else if (UserInput == 's' || UserInput == 'S') {
      if (BarChosen &gt;= 3) {
  
      }
      else {
          BarChosen++;
      }
  
    }
  }
  </code></pre>
  
  <p>Main Method</p>
  
  <pre><code>int main(void)
  {
  char UserInput = '0';
  int BarLeft[3] = { 30, 20, 10 };
  int Bar[3] = { 0, 10, 20 };
  int i = 0;
  int BarChosen = 0;
  
  do {
      system("cls");
      printf("Bar Chosen: %d\n", BarChosen);
      for (i = 0; i &lt; 3; i++)
      {
          BarValues(Bar[i], BarLeft[i], UserInput);
      }
      UserInput = getch();
      UpdateBar(UserInput, BarChosen, Bar, BarLeft);
  
  } while (1);
  
  
  //Stall
  getch();
  return 0;
  }
  </code></pre>
  
  <p>My issue is that, BarChosen doesn't change. I have tested the functions to print and check if they are activated, and they are, yet BarChosen does not change and stays at 0</p>