title: How do Arrays work in the "for" loop (C language)
body: <p>i am relatively new in c programming, and programming in general.</p>
  
  <p>1) I am trying to create an array named "input" that will be used for the user input (and the array will only use two integer elements).</p>
  
  <p>2) I want to use the for loop so it loop through my code 2 times, so i can duplicate the printf statement "Enter an integer," without me typing the printf statement multiple times. And then my scanf placeholder will be based my array "input." </p>
  
  <p>3) Then i want to add those two numbers together for the sum.</p>
  
  <p><strong>The problem:</strong> When the user enters a number, for example, 1 and then 1 again, the index at input[0] is 1 but then the index at 1 for input[1] is 2... </p>
  
  <p>I will use addition to try and explain.
  When i try to output the numbers in addition (integer[0] is 1, integer[1] is 2 and my variable which adds them together is "total")i get this: <strong>1+2=2.</strong></p>
  
  <p>So why is input[0] correct, but input[1] seems to be adding the two user inputs together and storing it in there?</p>
  
  <p>Here is my code</p>
  
  <pre><code>int main()
  {
      int input[1];
      for(int i = 0; i &lt; 2; i++)
      {
          printf("Please enter an integer: ");
  
          scanf("%d", &amp;input[i]);
  
      }
      int total = input[0]+input[1];
      printf("%d + %d = %d ", input[0], input[1], total);
  
  
  }
  </code></pre>
  
  <p>Thanks in advance, and i hope you understand me. Sorry i'm a noob, learning the basics so i can become advanced. </p>