Zack Li Zack Li - 2 years ago 150
C Question

C pass pointer as argument in function

I came across the following code:

int H3I_hook(int (*progress_fn)(int*), int *id)

I don't understand the purpose of
at the end of the first argument?

Answer Source


int (*progress_fn)(int*)

it can be interpreted like below:

int (*progress_fn)(int*)
 ^       ^          ^
 |       |          |___________ pointer to integer as argument
 |       |                                          ^
 |     pointer to any function that has | and takes |
 |                                      V
 |__________________________return type an integer
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download