I believe that it is not possible to return an array in both C and C++.Quote:
gcc (and g++) doesn't seem to allow functions returning arrays.
Yes, so we can return a pointer to the first element of the array. Since I am not sure of the syntax, I shall take the liberty of using a typedef:Quote:
Returning a pointer to pointer won't work, since you loose the dimension of the array. You will need to indicate at least the last dimension of the array.
Code:class MyClass {
public:
typedef int(*ArrayType)[5];
ArrayType getArray()
{
return array;
}
private:
int array[5][5];
};
See above. The thing is, vectors can make things easier.Quote:
So there is no way to do it without vectors?
This is part of C++'s C heritage, so you will face the same problem.Quote:
(Hm, maybe I should've posted in the C-forum instead, given the devlopement of this thread. Oh well..)

