Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

how to traverse a linked list in c++

//make sure you have access to the first node in the list 
for (Node *ptr = first; ptr != nullptr; ptr = ptr->next) {
    cout << ptr->data << " ";
  }
 
PREVIOUS NEXT
Tagged: #traverse #linked #list
ADD COMMENT
Topic
Name
5+8 =