void List::remove_last()
{
	
	if(first == NULL)
	{
		first -> data = ' ';
	}
	else
	{
		
		Node *newnode;
		newnode = new Node;
		newnode = NULL;
		newnode -> data = last -> back -> data;
		last = newnode;
		
	}
}

am I doing something wrong? I'm trying to remove the end of list node.

newnode = new Node;
newnode = NULL;

Eerrrr? That's a bit of weird code. You're trying to derefence that pointer on the next line! ;)

newnode = new Node;
newnode = NULL;

Eerrrr? That's a bit of weird code. You're trying to derefence that pointer on the next line! ;)

void List::remove_last()
{
	
	if(first == NULL && last == NULL)
	{}
	else
	{
		
		Node *temp;
		temp = last -> back;
		delete last;
		last = temp;
		
	}
}

how about this code? either way it is not not running right.

nvm figured it out, i forgot to do temp->next = NULL; before i assigned it to last.

what is code of removing if we want user to enter value from the list to remove in doubly linked list?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.