The return type will be int (*)[5]
(a pointer to a 5-element int
array), as shown below:
int (*foo(void))[5] { static int arr[5][5]; ... return arr; }
It breaks into
foo -- foo foo( ) -- is a function foo(void) -- taking no parameters *foo(void) -- returning a pointer (*foo(void))[5] -- to a 5-element array int (*foo(void))[5] -- of int
Remember that in most contexts, an expression of type "N-element array of T
" is converted to a type of "pointer to T
". The expression type arr
is βa 5-element array of 5-element int
arraysβ, so it is converted to βpointer to a 5-element array int
" or int (*)[5]
.
source share