title: Error with subscripted value being neither array nor pointer nor vector
body: <pre><code>    void display_grid(struct game_board *M, FILE *stream) {
          int i, j;
  
          /* malloc memory for appropriate amount of rows */
          M-&gt;border = malloc(sizeof(*M-&gt;border) * (M-&gt;width + 4));
  
  
          for (i = 0; i &lt;= M-&gt;width; i+=2){
              M-&gt;border[i] = M-&gt;border[M-&gt;width + 1] = '+';
              for (j = 1; j &lt;= M-&gt;width; j+=2){
                  M-&gt;border[j] = M-&gt;border[M-&gt;width] = ' ';
                  fprintf(stream, "%c\n", M-&gt;border[i][j]);
              }
          }
          M-&gt;border[M-&gt;width + 2] = '\0';
  
          fflush(stream);
     }
  </code></pre>
  
  <p>My question is in regards to this line <code>fprintf(stream, "%c\n", M-&gt;border[i][j]);</code> which shoots an error and stops the overall program from compiling. </p>
  
  <p>At the moment I am simply trying to read in the height and width from what the user is providing from the command line and using that to print out a 2D grid that I can then use later on to modify and such.  </p>
  
  <p>I have a solution which I <em>THINK</em> might fix it but I have no idea on how to implement it. I believe that in order to fix the problem I need to malloc border as a ** and then malloc the rows as *  </p>