Quote:
gcc (and g++) doesn't seem to allow functions returning arrays.
I believe that it is not possible to return an array in both C and C++.
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.
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:
Code:
class MyClass {
public:
typedef int(*ArrayType)[5];
ArrayType getArray()
{
return array;
}
private:
int array[5][5];
};
Quote:
So there is no way to do it without vectors?
See above. The thing is, vectors can make things easier.
Quote:
(Hm, maybe I should've posted in the C-forum instead, given the devlopement of this thread. Oh well..)
This is part of C++'s C heritage, so you will face the same problem.