I'm trying to return a pointer to a 2D static array. What I've tried is
I want to use the value get_array_ptr returns just like I'd use a 2D static array, for exampleCode:class Foo { public: void * get_array_ptr(); private: typedef int arr_t[10]; arr_t foo_array[10]; } void * Foo::get_array_ptr() { return foo_array; }
Of course, this doesn't compile. I get the error "array must be initialized with a brace enclosed initializer". Does anyone have any suggestions on how to pull this off?Code:class Bar : Foo { void process(); } void Bar::process() { arr_t x = get_array_ptr(); //compile error here int* val = x[2]; int val2 = val[3]; }