title: Filling array using array from function
body: <p>I am trying to fill a 2d array in function <code>drawInitialNim()</code>, using values passed from main.</p>
  
  <pre><code>int drawInitialBoard(int x, int y, int z);
  
  int main(int argc, const char * argv[]) {
  
      int board[3][50] = {{0}};
      int row1, row2, row3;
      int i, j;
  
      row1 = 0;
      row2 = 0;
      row3 = 0;
  
      printf("Enter the number of rocks in each row: ");
      scanf("%d %d %d", &amp;row1, &amp;row2, &amp;row3); //values for amount of "O" in the array
      printf("this is row 1: %d\n", row1); //debug
      board[2][49] = drawInitialBoard(row1, row2, row3); //fill array from function
  
      printf("this is 0,0 in main: %d\n",board[0][0]); // debug
  
      for (i=0; i&lt;3; i++) { //print indexes that contain "O" or 79
          printf("Row %d: ", i+1);
          for (j=0; j&lt;50; j++) {
              if (board[i][j] != 0) {
                  printf("%c", board[i][j]);
              }
          }
      printf("\n");
      }
  }
  
  int drawInitialBoard(int x, int y, int z)
  {
      int i,j,k;
      static int arr[3][50] = {{0}};
  
      for (i=0; i&lt;x; i++) { //fill board with "O", or its that equal 79
          arr[0][i] = 'O';
      }
      for (j=0; j&lt;y; j++) {
          arr[1][j] = 'O';
      }
      for (k=0; k&lt;z; k++) {
          arr[2][k] = 'O';
      }
      printf("This is 0,0 in the function: %d\n", arr[0][0]); //debug
      return **arr;
  }
  </code></pre>
  
  <p>I am getting this output, using <code>1, 2, 3</code> as input for <code>x, y, z</code> in main:
  Row 1: 
  Row 2: 
  Row 3: O</p>
  
  <p>I feel like the values from <code>drawInitialNim()</code> are not getting passed to main properly. I know that arrays can't be returned, so I returned the pointer. Additionally, I don't think that this is a dereferencing problem. I am not sure how to solve this.</p>
  
  <p>Any help would be appreciated!</p>