1

Possible Duplicate:
Typedef function pointer?

Could you please help me understand the meaning of this typedef and how to use it?

typedef void (*__handler)(int)

without the "typedef", I know the rest is a function pointer. Thank you.

Community
  • 1
  • 1
cody
  • 651
  • 2
  • 8
  • 16

1 Answers1

2

This defines a type name for the function pointer. Using this, __handler is now a type alias for a pointer to a function that takes an int and returns void.

void myFunction(int)
{
    // ...
}

int main(int argc, char **argv)
{
    __handler functionPtr = &myFunction;

    // ...
}
pb2q
  • 58,613
  • 19
  • 146
  • 147