Confusing function definition

Hi All,

Can you kindly tell me what the following is supposed to mean:

void *SomeFunction (AnotherFunction *, int);

I am trying to decipher some code. Thanks!
It seems a declaration of a function called SomeFunction returning a pointer to void and taking an argument of type AnotherFunction * and the other of type int
Is odd the part AnotherFunction * as it looks as a pointer to function but pointers to function have a different syntax
It could be possible that they have actually typedef'd the actual function prototype.
That's the way I always handle function pointers -- via typedef:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// the type
typedef int (*quux_t)( int, int );

// a prototype
int my_quuxxer_01( int, int );

// a variable
quux_t quuxxer = NULL;

// a pointer to the variable
quux_t* pquuxxer = &quuxxer;

// use the pointer to make the quuxxer quuxable
*pquuxxer = &my_quuxxer_01;

// do some quuxxing
quuxxer( -7, 43 );

//etc 

Make sure you read through The Function Pointer Tutorials
http://www.newty.de/fpt/

Hope this helps.
Last edited on
@Duoas: Thanks, I guess that is what I am dealing with here. Am going through the Function Pointer Tutorials.
Topic archived. No new replies allowed.