C++ typedef declaration

c++, typedef

Solution

It means that `Callback` is a new name for the type : pointer to a function returning an int and taking two parameters of type 'const pointer to void' and 'int'.

Given a function `f` :

int f(void * const param, int s)
{
    /* ... */
}

The `Callback` can be used to store a pointer to `f` :

Callback c = &f;

The function `f` can be later invoked through the pointer without directly referring to its name :

int result = c(NULL, 0);

At the point of the call, the name `f` does not appear.

Problem

Can you please explain what does the following line means? ``` typedef int (*Callback)(void * const param,int s) ```

Original source