title: Filling a structure
body: <p>I'm trying to make a C program in which user is able to add multiple students to the list. The point of that is to <strong>create a database</strong> of students (<strong>without accessing a .txt file</strong>, It just has to be able to add students and then search for a specific student by surname in the same run, no saving).</p>
  
  <pre><code>struct student{
  int semester;
  char major[20];
  char name[20];
  };
  
  struct person{
  int id;
  char surname[30];
  struct student data;
  }stud;
  
  typedef struct person* st[10];
  int m=0;
  
  int add(){
  printf("Type student's surname\n");
  st[m]-&gt;surname=getchar(); //that's basically the part in which I need help
  m=m+1;
  }
  </code></pre>
  
  <p>While I think I can handle searching, I don't really know how to do the adding part. I want to keep it as simple as possible (I'm a freshman). My intent is to use structure <strong>person</strong> (with <strong>student</strong> nested to it) and then whenever the user calls function <strong>add</strong> they'll be able to add one student (let's say that the max is 10). My idea was to make 10 structures (struct[m]) with m rising each time function <strong>add</strong> is called, but it seems not to work the way I expected.</p>
  
  <p>How can I make it happen? Any help is much appreciated.</p>