Reputation: 8135
Node RemoveString(Node (*)(char,Node));
Node Minimum(char, Node);
Node Minimum(char type, Node node) {......}
Node RemoveString(Node(*Minimum)(char, Node)) {...}
void Test_Function(Node (*)(char,Node));
void Test_Function(Node(*Minimum)(char, Node)) {...}
Test_Function(Node(*Minimum)(char, Node));//This line has error.
The compiler complains that error: expected expression before ‘Node’
Can anybody tell me why ?What i did wrong in this case?
Upvotes: 0
Views: 565
Reputation: 20179
When you call a function, you just use the name of the function rather than the complete definition again. So this line:
Test_Function(Node(*Minimum)(char, Node));
Should be:
Test_Function(&Minimum);
Of course you should also make sure that the functions Test_Function and Minimum are defined (i.e. files included) before this statement.
Upvotes: 4
Reputation: 4633
The expression you are using as Test_Function
argument is a type, not a function pointer. The function pointer is just the function's name:
Test_Function(Minimum);
Upvotes: 1
Reputation: 51226
You tagged this c
, so I take it you're using a C compiler (not C++) -- right? In that case you need to either write struct Node
in each declaration, or use a typedef
.
Upvotes: 0