Hi - i just needed some help. I'm constructing a circular linked list which means 1st node points to 2nd, and so on. The task i need to accomplish is that i need to remove one node (any node in the linked list). So lets say i have 8 nodes in my circular linked list and i want to remove the 4th node. We know that the 4th node points to the 5th node. Anyway, my current function has no problem with deleting any node except for the 2nd no. No matter what I try to do, I cannot delete the 2nd node. Here is my function: Im sorry if there isn't enough info here, but you can ask and i'll be happy to reply back. Thanks.

Code:

node* prev = current; // current is the head of the linked list – im making a pointer prev to //also point to head

node* cur; // just another pointer

cur = prev; // let cur also point to the head of the linked list

for (int i=1; i <= size(); i++) // size is the size of the linked list

{

if (prev -> num == x ) // x is the node I want to delete – so if the first node contains the //data (num is the data field of the node) – then do the following

{

cur -> shortlink = prev -> shortlink ;

delete cur;

length--;

}

cur = prev;

prev = prev -> shortlink;

}