title: Using a 2D array global variable in C when I only know one dimension at compile-time
body: <p>My situation is odd. I have a global 2D array of chars (meant to represent an array of strings). These strings will have a length no greater than 28, including the terminating character, so I just want to use a 2D array with one dimension set to 28. The other dimension is determined at compile-time, but my program counts how many slots it will need before it allocates the array.</p>
  
  <p>I'm trying to declare the array like this (global):</p>
  
  <pre><code>char** dictionary;
  </code></pre>
  
  <p>Then in one of my functions, I need to allocate it. These two give me bad access errors once I try to access them with dictionary[0][0] or something:</p>
  
  <pre><code>dictionary = malloc(sizeof(char)*(28)*numberWords); //numberWords ends up being around 60000
  //separately:
  char newDict[numberWords][28];
  dictionary = newDict;
  </code></pre>
  
  <p>Yes, I'm kinda new to C. Wish my school taught me it instead of Java.</p>