How to return 2 dimension array in C++
<p>I have a segmentationfault at the line : cout &lt;&lt;  b[0][0];</p>

<p>Someone can tell me what I should do to fix my code? </p>

<pre><code>#include &lt;iostream&gt;
using namespace std;

int** gettab(int tab[][2]){
   return (int**)tab;
}

int main() {
   int a[4][2] = {{0, 0}, {1, 0}, {2, 0}, {2, 1}};
   int ** b = gettab(a);
   cout &lt;&lt;  b[0][0];
   return 0;
}
</code></pre>
