Re: Function pointer prototype interpretation





John Bode wrote:

Alfonso Morra wrote:

Hi all,

I came accross this FP signature and it has me baffled.

Can anyone explain this signature to me - i.e what are the input and
output types ?

void(*(*foo)(int))(int,void(*)(int))

Thanks


foo                               -- foo
*foo                              -- is a pointer
(*foo)()                          -- to a function
(*foo)(int)                       -- taking one int parameter
*(*foo)(int)                      -- returning a pointer
(*(*foo)(int))()                  -- to a function
(*(*foo)(int))(int, void(*)(int)) -- taking two parameters,
                                     one int and the other
                                     a pointer to a function
                                     taking one int parameter
                                     and returning void
void (*(*foo)(int))(int, void(*)(int)) -- returning void

To summarize, foo is a pointer to a function that returns a pointer to
a function that returns void.

Thanks

.



Relevant Pages