abhishek_M
abhishek_M

Reputation: 1170

Understanding c function pointers

Statement:

"array of N pointers to functions, returning pointers to functions and returning pointer to integer"

Can anyone help me with understanding the function prototype for above statement ?

Given answer- int *(*(*a[N])()) ();

Please can anyone explain me how we arrive at the above answer ?

Upvotes: 1

Views: 94

Answers (2)

SMFSW
SMFSW

Reputation: 286

*a[N]

is the array of N pointers, calling it x

*(x)()

returning function pointer, calling it y

int *(y) ()

is function pointer returning integer

Upvotes: 1

GorvGoyl
GorvGoyl

Reputation: 49220

int *(*(*a[500])()) ();

Translates to:

declare a as array 500 of pointer to function returning pointer to function returning pointer to int


Note:Next time, use this site to understand complex pointer statements http://cdecl.org/

Upvotes: 1

Related Questions