Search code examples
cfunction-pointersfunction-declaration

Explain the difference in these function pointer declarations


Please highlight the difference between the following function declarations:

  1. void (*p) (void *a[], int n)

  2. void *(*p[]) (void *a, int n)


Solution

    1. void (*p) (void *a[], int n) defines a pointer to a function that takes a void* array and an int as parameter

    2. void *(*p[]) (void *a, int n) defines an array of pointers to functions that return a void*, and take a void* and an int as parameter.