The simplest approach is to store two things when we push a new element onto the stack. We must store not only the new data item, but also a reference to the item that was previously at the top of the stack, so that, when we pop the first item, we know what we should be left with. Of course that previous item would have been stored in the same way, with a reference to the one before that, and so on. So we need some way of telling that the list is terminated. The conventional approach is to use the null reference, playing the role of the empty list.