The stack is one of the most important data structures in computer science . As data items are added to the stack , the stack pointer is displaced to indicate the current extent of the stack , which expands away from the origin . Stack pointers may point to the origin of a stack or to a limited range of addresses either above or below the origin ( depending on the direction in which the stack grows ) ; however , the stack pointer can not cross the origin of the stack .