title: using scanf("%d ") with a space after the %d
body: <p>In my c class today I was troubling with the scanf() command, we were just learning pointers and we got a question asking us to get an array, and print it reversed without using the [] for anything but declaring the (int) array. Of course it seems like a piece of cake but not when you accidentally write:</p>
  
  <blockquote>
    <p>scanf("%d ", arr + i);</p>
  </blockquote>
  
  <p>Did you notice the space after the %d? Sure did take me a while to figure it out but for some reason that makes loops go crazy, and I wanted you guys to help me (and my teachers) to figure out why does that happen. Example:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #define LEN 10
  void arrayInput(int * arr, unsigned int len);
  void arrayReverseOutput(int * arr, unsigned int len);
  
  int main(void)
  {
      int arr[LEN] = { 0 };
      arrayInput(arr, LEN);
      arrayReverseOutput(arr, LEN);
  
      system("pause");
      return 0;
  }
  
  void arrayInput(int * arr, unsigned int len)
  {
      unsigned int i = 0;
      printf("Enter 10 numbers: ");
      for (i = 0; i &lt; len; i++)
      {
          //printf("i = %d \n", i); see what happens when you use this line
          scanf("%d ", arr + i);
      }
  }
  
  void arrayReverseOutput(int * arr, unsigned int len)
  {
      int i = 0;
      printf("The numbers in reverse order: ");
      for (i = --len; i &gt;= 0; i--)
      {
          printf("%d ", *(arr + i));
      }
  }
  </code></pre>
  
  <p>I'm really curios to see what's going on with that scanf... it's as if it requires 2 inputs at the first time it runs but somehow still manages to put the inputs in their right position in the array...
  Thanks for taking your time to read this &lt;3</p>