using an STL vector or other STL container is one way of doing it.
Another way would be to return a pointer to a pointer , since a 2 dimensional "array" is nothing more then a pointer to a pointer so in practice it looks like this
int **func_return()
{
int **ppArray = NULL;
....do stuff here....
return ppArray;
}
Note: in 99% cases you have to know how big the array is, so you also have to return the actual size of the array. for this purpose you could use the function parameters , for example
int **func_return(std::size_t &xsize, std::size_t &ysize)
{
int **ppArray = NULL;
....do stuff here....
return ppArray;
}