Reputation: 554
I declare a global struct Word *root = NULL; which I populate by using some pthread calls(created a BST) and when I go to print out an inorder traversal function by calling inorder(Word *root), it gives me an error saying "unexpected type name 'Word': expected expression". I don't understand what am I doing wrong.
void ordered(Word *root); // declaring function
//code//
Word *root = NULL; // declare global pointer to root
/*Main*/
//code that does some work and eventually creates a BST with root
ordered(Word *root); //call to my function
Upvotes: 2
Views: 668
Reputation: 30136
Follow these rules:
In your example, the variable type is Word*
and the variable name is root
.
So change this:
ordered(Word *root); //call to my function
To this:
ordered(root); //call to my function
Upvotes: 4