title: C++ passing/accessing matrix by pointers
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/1285457/2d-arrays-with-c">2D arrays with C++</a>  </p>
  </blockquote>
  
  
  
  <p>Hi, I'm trying to copy a pointer to a matrix that i'm passing in to a function in C++. here's what my code is trying to express</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  void func( char** p  )
  {
      char** copy = p;
      cout &lt;&lt; **copy;
  }
  
  int main()
  {   
      char x[5][5];
      x[0][0] = 'H';
      func( (char**) &amp;x);
      return 0;
  }
  </code></pre>
  
  <p>However, this gives me a Seg Fault. Would someone please explain (preferrably in some detail) what underlying mechanism i'm missing out on? (and the fix for it)</p>
  
  <p>Thanks much in advance :)</p>