Function pointers

Suppose I have a function A()that takes in as one of its parameters a pointer to a function B(). If I want to pass to this function A() another function, what would be the correct syntax? Would it just be A(functionName), or would I pass parameters in the call?
What do you mean? If "another function" matches the type of funtion A() expects, you would pass it the same way as you would pass B to A()...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
void B(){}

void (*ptr)() = B;

void A(void(*f)()){}
//passing B
A(B);
//passing pointer
A(ptr);

void X(){} //new one!

//passing X this time
A(X);

int ERR(){} //new one
A(ERR);  //ERROR argument must be void function! 
Topic archived. No new replies allowed.