title: return value of malloc
body: <p>I have the following code parts:</p>
  
  <pre><code>typedef struct Board* BoardP;
  
  typedef struct Board {
      int _rows;
      int _cols;
      char *_board;
  
  } Board;
  
  char* static allocateBoard(BoardP boardP, int row, int col) {
  
      boardP-&gt;_rows = row;
      boardP-&gt;_cols = col;
      boardP-&gt;_board = malloc(row * col * sizeof(char));
  
      return boardP-&gt;_board;
  }
  </code></pre>
  
  <p>i can't seem to figure out why it gives the error 
  expected identifier or ‘(’ before ‘static’
  it gives the error after i changed return type to be char*. when it was void no error was given.</p>
  
  <p>and one more question: i was taught that cast is needed when using malloc, however, this seems to be working ok without a cast. is it needed in this case?</p>
  
  <p>thanks</p>