Day#54 'C' Coding Challenge

Day#54 'C' Coding Challenge

What does the below declaration signify?

int * (*f[5]) (int *, int *);

-------------------------------------------------------

For an experienced programmer, the above declaration is easy to understand. For a beginner, it looks clumsy and hard to explain the declaration. One step for them could be to divide the declaration in the below manner.
When it is divided in the above manner, we could see 3 parts,

1. An array of 5 function pointers ((*f[5]))
2. The return type is integer pointer (int *)
3. Two integer pointers are passed as arguments  (int *,int *)

Few more points,
  • Function name itself can be used to get the function address.
  • Function pointer holds the starting address of the executable code
  • In the above code we have declared array of function pointers which is a valid declaration

Post a Comment

0 Comments