[c++] Return a 2d array from a function

That code isn't going to work, and it's not going to help you learn proper C++ if we fix it. It's better if you do something different. Raw arrays (especially multi-dimensional arrays) are difficult to pass correctly to and from functions. I think you'll be much better off starting with an object that represents an array but can be safely copied. Look up the documentation for std::vector.

In your code, you could use vector<vector<int> > or you could simulate a 2-D array with a 36-element vector<int>.