views:

65

answers:

3

Hi,

With respect to this question, we can declare a function that returns pointer to array as:

int (*function())[3]

which returns Ax3 array, ok.

How is the proper way to declare a function pointer that points this kind of function?

A: 

See this reference, which is quite helpful. Note the techniques using typedefs

typedef int (*pfintarray())[3];

pfintarray myFunc() { /* etc
djna
A: 

Perhaps

int (*(*function_pointer)())[3];

(at least gcc seems to understand it)

Giuseppe Guerrini
+3  A: 
        f                 -- f
       *f                 -- is a pointer
      (*f)()              -- to a function
     *(*f)()              -- that returns a pointer
    (*(*f)())[3]          -- to a 3-element array 
int (*(*f)())[3]          -- of int
John Bode