Me again, this time I really have a problem.
I'm trying to add an element before a certain element.
Now the thing is that when I find the number and try to add a new number it adds OK but then it deletes the last element of the list.
How do I fix this? This is my code below:
node* p_before = find_element(number, k_beginning); //return a pointer to an element we're trying to find node* p_after = p_before->k_next; node* k_new= new node; k_new->number= number; k_new->k_next= k_after; p_before->k_next= k_new;