title: Convert string to char 2d array
body: <p>I was wondering does anyone know how to convert a string into a 2d array? This was my attempt:</p>
  
  <pre><code>string w;
  char s[9][9];
  int p=0;
  getline(cin, w);
  while(p != w.size())
  {
    for (int k = 0; k &lt; 9; k++)
    {
      for(int j = 0; j &lt; 9; j++)
      {
        s[k][j] = w[p];
        p++;
      }
    }
  }
    cout &lt;&lt; "nums are: " &lt;&lt; endl;
    for(int k = 0; k &lt; 9; k++)
    {
      for(int j = 0; j &lt;9; j++)
      {
        cout &lt;&lt; s[k][j];
      }
    }
  </code></pre>
  
  <p>But the numbers don't print out correctly. I want s[k][j] to print out everything in w but it simply prints out gibberish. I also noticed if i do string[81] then I get a whole bunch of errors. Could anyone help me? Thanks.</p>