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

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -