Modifying element of info of a node in linked list

Hello everyone,

How can i modify the info of a node in linked list?

Example: A node contains studentName and studentID, I want to change the studentID. How can i do that?
Do you have a pointer that's traversing the linked list looking for the node that contains the info you want to modifiy? You can use the name of the pointer and the arrow operator to access a data member of the node.

pointer->studentID = newinfo
Last edited on
Traverse through the nodes with the linking pointer, whiles checking if the name matches the one whose I'd you want to change.

Aceix.
Do you have a pointer that's traversing the linked list looking for the node that contains the info you want to modifiy? You can use the name of the pointer and the arrow operator to access a data member of the node.

pointer->studentID = newinfo


Thanks for replying. How do I passing the
newinfo
in main function to my update function by doing that? Sorry I'm a beginner :)
Last edited on
Traverse through the nodes with the linking pointer, whiles checking if the name matches the one whose I'd you want to change.

Aceix.


Thanks for replying. Let's say now I already found the node that I want to update, how can I update one of the element which is studentID, but not the other one which is studentName? :)
Topic archived. No new replies allowed.