title: Deep copying array in C... malloc?
body: <p>I'm trying to make a deep copy of an array in C (originalBoard being the copy):</p>
  
  <pre><code>int gy, gx;          
              for (gy=0; gy&lt;9; gy++)
              {
                  for (gx=0; gx&lt;9; gx++)
                  {                  
                  g.originalBoard[gy][gx]=g.board[gy][gx];
                  }
              }
  </code></pre>
  
  <p>This does not seem to be working out, and I'm guessing this is just making pointers to the original board array.</p>
  
  <p>So would the solution be to try and use malloc? Like:</p>
  
  <pre><code>    int* g.originalBoard[9][9]=malloc(sizeof(g.board[9][9]));
  </code></pre>
  
  <p>btw this is a 9x9 two dimensional array. What would the syntax be (the compiler gives an error for the above line...)?</p>