DELETING A NODE FROM THE END OF LIST

HI EVERYONE.

I'M TRYING TO DELETE FROM THE END OF A LINKLIST
Actualy I delete the last node but the problem is that I lost the end of the list, in other words my list leaved of pointing to NULL.
I reaaly don't know how to fixed, (it was more easy to delete from head)

anw if someone can help me I will really really really appreaciate.
THANKS.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
void linkedstack::pop()
{
	
	if(head==NULL){
		cout<<"The linklist is empty"<<endl;
		return;}
else
	{
		node *current=head;
		
		while(current->next->next!= NULL)
		{
			
			current=current->next;

		}
		
		
		
		node* save=current;
		current=NULL;
		delete save;
		size--;
Last edited on
Topic archived. No new replies allowed.