Reading function pointer syntax

Posted by bobobobo on Stack Overflow See other posts from Stack Overflow or by bobobobo
Published on 2010-05-02T19:02:01Z Indexed on 2010/05/02 19:07 UTC
Read the original article Hit count: 141

Filed under:
|

Everytime I look at a C function pointer, my eyes glaze over. I can't read them.

From here, here are 2 examples of function pointer TYPEDEFS:

typedef int (*AddFunc)(int,int);
typedef void (*FunctionFunc)();

Now I'm used to something like:

typedef vector<int> VectorOfInts ;

Which I read as

typedef vector<int> /* as */ VectorOfInts ;

But I can't read the above 2 typedefs. The bracketing and the asterisk placement, it's just not logical.

Why is the * beside the word AddFunc..?

© Stack Overflow or respective owner

Related posts about c++

Related posts about function-pointers