c - Passing global pointer to function -
i declare global struct word *root = null; populate using pthread calls(created bst) , when go print out inorder traversal function calling inorder(word *root), gives me error saying "unexpected type name 'word': expected expression". don't understand doing wrong.
void ordered(word *root); // declaring function //code// word *root = null; // declare global pointer root /*main*/ //code work , creates bst root ordered(word *root); //call function
follow these rules:
- you must specify variable type when declare function
- you may specify variable name when declare function
- you must not specify variable type when call function
in example, variable type word*
, variable name root
.
so change this:
ordered(word *root); //call function
to this:
ordered(root); //call function
Comments
Post a Comment