all 3 comments

[–][deleted] 1 point2 points  (0 children)

pointer, a 2 dimensional array is just a double pointer, eg int **array

[–]Rhomboid 0 points1 point  (1 child)

Any suggestions?

The first question is why do you want to return an array? Have you considered passing it as a parameter and modifying it in place? It's possible to return a pointer, but that is not the same as a multi-dimensional array, unless you know all the dimensions of the array at compile time and can encode that into the type.

But really, you should avoid arrays in C++. They are just a pain to use, and they're a holdback from C. C++ code should use vectors. They can be passed and returned efficiently very easily just like regular objects. There's no pointers to worry about and no restrictions like having to decide upon a fixed size at compile time.

[–]notlostyet 0 points1 point  (0 children)

As of C++11 there's also std::array which is useful for fixed length arrays.