title: Allocating memory to pointer structures inside structures
body: <p>If I have a structure such as </p>
  
  <pre><code>typedef struct _people {
   char *name;
  
   bool *exists;
  
   struct _people **citizens;
  } PEOPLE;
  </code></pre>
  
  <p>How do I go about allocating memory so that people->citizens[0]->name is accessible? I've tried </p>
  
  <pre><code>info-&gt;citizens = malloc(sizeof(PEOPLE *)*numbPeople);
  </code></pre>
  
  <p>However when I try to access info->citizens->name I get the error message in GDB:</p>
  
  <pre><code>Program received signal EXC_BAD_ACCESS, Could not access memory.
  Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000008
  </code></pre>