title: Implementing and using a dynamic array in C
body: <p>I'm trying to make a list of students that stores structs using a dynamically allocated array. For this I have the following structs:</p>
  
  <pre><code>typedef struct s_student 
  { 
      char name[64];     
      int matrikelNummer; 
  } student; 
  
  typedef struct s_studentList 
  { 
      student* students;
      int numberOfStudents; 
  } studentList;
  </code></pre>
  
  <p>This is how I use them so far:</p>
  
  <pre><code>int main(int argc, char** argv) {
  
      studentList* list = NULL;
      list = (studentList*) malloc(sizeof(studentList));
  
      list-&gt;numberOfStudents =1;
      //list-&gt;students-&gt;matrikelNummer = 1;
      //strcpy(list-&gt;students-&gt;name , "karim");
  
      printf("numberOfStudents : %d\n" , list-&gt;numberOfStudents );
      //printf("matrikelNummer   : %d\n" , list-&gt;students-&gt;matrikelNummer);
      //printf("name             : %d\n" , list-&gt;students-&gt;name);
  
      free(list);
  
      return 0;
  }
  </code></pre>
  
  <p>That seems to work with no problems. But when I try to assign data to the students (<code>matrikelNummer</code> or <code>name</code>) as outlined in the commented lines, I receive a Segmentation fault.</p>
  
  <p>What am I doing wrong?</p>