how do I modify a value in a linked list..lets say I have a name and phone number..how I would modify the phone number??
Thanks
A :)
Printable View
how do I modify a value in a linked list..lets say I have a name and phone number..how I would modify the phone number??
Thanks
A :)
Code:strcpy(node->phone, new_phone);
strcpy(node->name, new_name);
Are you asking about the actual editing process or going to a specific place in the stack?
You can traverse through the list and let a pointer point to the node which you want to change. Then you can change the attributes of that note.
Code:if (list_pointer->key == requested_key)
{
list_pointer->item = new_value_for_item;
}