Is there any other way to receive a reference to an array from function returning except using a pointer?
Here is my code.
int ia[] = {1, 2, 3};
decl
Is there any other way to receive a reference to an array from function returning except using a pointer?
Yes, using a reference to an array, like with any other type:
int (&ref)[3] = a.foo();
To avoid the clunky syntax, you could use a typedef
instead.
typedef int int_array3[3];
...
int_array3& foo() { return ia; }
...
int_array3& ref = a.foo();