title: scanf("%[^\n]") gets skipped
body: <p>I want to write a little program to learn C; here it is:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  
  int total;
  char suffix[3];
  struct person {
      char id[11];
      char name[21];
      char sex[7];
      int age;
      char phone[12];
  };
  
  char* number_suffix (int number) {
      int mod;
      mod = number % 10;
  
      switch (mod) {
          case 1:
              strcpy(suffix, "st");
              break;
          case 2:
              strcpy(suffix, "nd");
              break;
          case 3:
              strcpy(suffix, "rd");
              break;
          default:
              strcpy(suffix, "th");
              break;
      }
      return suffix;
  }
  
  void input_info (struct person info[], int total_people) {
      int counter;
      for (counter=0; counter&lt;total_people; counter++){
          printf("%s%d%s%s\n","Please input the ID(10 digits) of ", (counter+1),
                  number_suffix(counter), " person: ");
          scanf("%s", info[counter].id);
          fflush(stdin);
  
          printf("%s%d%s%s\n", "Please input the Name(20 chars) of ", (counter+1),
                  number_suffix(counter), " person: ");
          scanf("%[^\n]", info[counter].name);
          fflush(stdin);
  
          printf("%s%d%s%s\n", "Please input the Sex(Male/Female) of ", (counter+1),
                  number_suffix(counter), " person: ");
          scanf("%s", info[counter].sex);
          fflush(stdin);
  
          printf("%s%d%s%s\n", "Please input the Age(1~100) of ", (counter+1),
                  number_suffix(counter), " person: ");
          scanf("%d", &amp;info[counter].age);
          fflush(stdin);
  
          printf("%s%d%s%s\n", "Please input the Phone of ", (counter+1),
                  number_suffix(counter), " person: ");
          scanf("%s", info[counter].phone);
          fflush(stdin);
      }
      printf("%s\n%s\n%s\n%d\n%s\n", info[counter].id, info[counter].name, info[counter].sex, &amp;info[counter].age, info[counter].phone);
  }
  
  int main (void) {
      printf("%s\n", "Please input a number that how many people you want to record:");
      scanf("%d", &amp;total);
      fflush(stdin);
      struct person *person_info = malloc(sizeof(struct person)*total);
      input_info(person_info, total);
  
      free(person_info);
      return 0;
  }
  </code></pre>
  
  <p>I found something weird, when I run it.</p>
  
  <pre><code>Please input a number that how many people you want to record:
  1
  Please input the ID(10 digits) of 1th person:
  A01
  Please input the Name(20 chars) of 1th person:
  Please input the Sex(Male/Female) of 1th person:
  Male
  Please input the Age(1~100) of 1th person:
  32
  Please input the Phone of 1th person:
  1224464
  [empty line]
  [empty line]
  [empty line]
  1926234464
  [empty line]
  </code></pre>
  
  <p>Is that program skip <code>scanf("%[^\n]", info[counter].name);</code> this line when it run?</p>
  
  <p>Why, and what causes it?</p>