codesidian/SDI

Create a method that returns the second element of the stack

Closed this issue · 1 comments

Create a method that returns the second element of the stack
node list::returnNode(int pos) {
	node *current;
	current = root;
	if (current != NULL) {
		for (int i = 0; i < pos; i++) {
		
			current = current->next;


		}
	}
	else { std::cout << "ERROR: List Empty"; }
	return *current;
}

Returning any node from the list.