node *insertPlaceOrder(node *head, char *firstName, char *lastName, int day, int month,
int year, char *birthPlace) {
//CODE
return head;
}
node *insertToList(node (*(*order))(node*, char*, char*, int, int, int, char*), node *head,
char *firstName, char *lastName, int day, int month, int year, char *birthPlace) {
return (*order)(head, firstName, lastName, day, month, year, birthPlace);
}
When I debug this code, the compiler gives me the following error:
incompatible types when returning type 'node {aka struct node}' but 'node * {aka struct node *}' was expected.
How can I get the insertToList() function to return the pointer to a struct node that the function insertPlaceOrder() returns?
You have an extra set of parenthesis in the function pointer type. You have:
node (*(*order))(node*, char*, char*, int, int, int, char*)
Which defines order to be a pointer-to-pointer-to-function returning a node, not a pointer-to-function returning a node *. It should instead be:
node *(*order)(node*, char*, char*, int, int, int, char*)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With