c++ - Expected ';' before 'currentNode' -
here code
void llinsertafter(list* mylist, node *insnode, std::string *tostore) { node node; node.value = *tostore; if(llsize(mylist) == 0) { (mylist -> head) = &node; (mylist -> tail) = &node; } else { node currentnode = *(mylist -> head); while(currentnode.value != (insnode -> value)) { currentnode = *(currentnode.next); } if(currentnode.next == null) { currentnode.next = &node; } else { node.next = currentnode.next; currentnode.next = &node; } } }
here error message
llist.cpp:73:8: error: expected ‘;’ before ‘aa’ node aa = *(mylist -> head);
i can't see why error happen.
the problem here:
node node;
after that, name node
refers local variable, not type. since it's class type, refer class node
or struct node
thereafter; better option might use different name variable.
Comments
Post a Comment