Hi all, I'm having a problem here!! I've attended a lecture on Implementation of stacks in c++ using arrays and it wasn't really hard to understand, but now I'm supposed to know how to Implement a stack using linked list, that's the problem. help please?:confused:

Make a list with head pointer pointing to the first element of the linked list.
PUSH operation:-
make a new node of struct node (structure of a node in linked list)
and add this node at the start making it the head of the list.

POP operation:-
delete the header node and make this next linked node head.

thanks alot, I'll try it!!:)

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.