I have a slight issue yet again. The code is:
for (int z = 1; z <= length; z++)
if (longlinker -> longlink -> num == number)
longlinker -> longlink -> num = number;
longlinker = longlinker -> shortlink;
Now, assume the linked list has 6 nodes. Each node has 2 links, one to it's next node, and one to it's 3rd node after itself. So, 1 points to 2 (shortlink) and 4(longlink), 2 points to 3 (shortlink) and 5 (longlink), and 3 points to 4 (shortlink) and 6 (longlink).
Anyway i got an integer value "number" which is holding the correct information in it. I need to be able to make node 6 have a long link to itself when node 3 is deleted (as node 3 points to 6). The problem i'm having is that when i delete node 3, node 6 is still pointing to node 3 and not itself. The "num" you see there is the value of the longlink number each node has. Any ideas to see what i'm doing wrong?
I know "number" is holding the correct value in there (which is 6 when 3 gets deleted), as i've tested it just before the for loop
with a cout statement. Once it gets into the for loop, it cannot access "number" variable. Any ideas?
Basically, all i'm trying to do is go through each node in the list, and if that node's longlink number equal to the number variable, then update the number.