Hi guys, I would just like to ask. If let's say, I had a list with the following elements:
1, 2, 4, 6, 3, 8
and I wanted to look for 6. I traverse the list from the start node, and go through 1, 2, 4 and then 6. And then that's when I stop traversing the list, right? Now, when I stopped traversing the list, is the address of the 4th node (where the 6 is) saved in memory? If let's say I had my structure laid like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
struct Node{
int data;
struct Node *next;
} *start;
void deleteData(int x){
...
findNode(x);
}
void findNode(){
struct Node *jumper;
...
}
|
You see, what I'm trying to do is:
- user keys in the value he wants to delete
- find if the value exists in the list
- delete the value from the list (and any possible re-occurrences)
So, I sort of need to get the address of the last node that I passed from the findNode() back to deleteData() because I need to delete/free that particular node.