Sunday, August 2, 2009

In c++, how would u delete a node from a linked list?

ok so im supposed to delete a user specified node from a list of 10 nodes. I can locate the node but how would i actually delete it? I like dymanic arrays but sometimes r a pain cause of pointers :(

In c++, how would u delete a node from a linked list?
In general you will





1. Point the previous node at the next node


2. If it's a doubly linked list point the next node at the previous node


3. Destroy the current node, being sure to delete and release all allocated memory.





This site provides more detail:


http://www.inversereality.org/tutorials/...


No comments:

Post a Comment