title: Dynamically allocated string arrays in C
body: <p>I'm trying to understand how dynamically allocated arrays work in C 99. Anyways, I have the following code:</p>
  
  <pre><code>int main()
  {
      char** members=malloc(4*sizeof(*members));
      *members=malloc(5);
      *members="john";
      *(members+1)="shouldn't work";
      printf("%s \n",*members);
      printf("%s",*(members+1));
      return 0;
  }
  </code></pre>
  
  <p>I thought I would get a run time error because I didn't allocate (members+1), but actually it did print both "john" and "shouldn't work", Also, it apperas the the *members=malloc(5) line wasn't necessary. Why?</p>