title: Program crashes when trying to assign value to a dynamically allocated 2D array
body: <p>I'm trying to program something for a final project in my C Programming class but I'm stuck on a problem I can't figure out. My code is:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  char** allocateLevel(int sizeOfLevel);
  
  int main(void)
  {
  
      char** level = allocateLevel(10);
      int one, two;
  
      for(one = 0 ; one &lt; 10 ; one++)
      {
          for(two = 0 ; two &lt; 10 ; two++)
          {
              level[one][two]='T'; //Crashes right here
  
          }
      }
      printf("%c", level[4][5]); //tests to see if it prints
  }
  
  char** allocateLevel(int sizeOfLevel)
  {
      char **levelPointer;
      levelPointer = (char **)malloc(sizeOfLevel * sizeof(char **));
      int count = 0;
  
  
      for(count = 0 ; count &lt; sizeOfLevel ; count++)
      {
          levelPointer[count] = (char*) malloc(sizeOfLevel * sizeof(char*));
  
      }
  }
  </code></pre>
  
  <p>The program allocates the memory fine but it crashes when I try to assign a value to one of the elements. I can't figure out what's going wrong and my professor hasn't been of much help. Is there anything wrong?</p>