title: array of structs in c-user input
body: <p>I am new to programming in general and to <code>C</code> in particular. 
  I am trying to write a program that uses an array of structs, but I am experiencing problems if that struct contains strings. 
  Somehow the compiler crashes after the user has given the last input. </p>
  
  <p>The struct below is just a simplified version containing only one item, because the problem seems to be reading strings into the array. 
  Any help is much appreciated, thanks in advance. </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  typedef struct
  {
      char* name;
  }student;
  
  int main()
  {
      int size;
      printf("enter number of entries\n");
      scanf("%d" , &amp;size);
      student* all=malloc(size*sizeof(student));
  
      int i;
      for(i=0;i&lt;size;i++)
      {
          printf("enter name\n");
          scanf("%s" , all[i].name);
      }
  
      return 0;
  }
  </code></pre>