Call stack#Structure

The stack pointer or English. stack pointer (also: Basement pointer ), often abbreviated SP, is a special register that contains the address of the currently top element of the call stack. He is incremented or decremented by:

  • Push and pop operations ( register contents are stored in the stack or restored from the stack )
  • Subroutine calls and jumps back to the main program ( the return address is stored in the stack or read from the stack )

Note that the stack in microprocessors (at least x86 family ) stored in the memory, and the inverse of other data is accessed ( addressed) is. In an address range from x00 to xFF the first entry would therefore made ​​at the point xFF, then according ... followed by other entries in the places xFE, XFD, xFC to x00.

What has just been designated as top element, would thus come to lie at the lowest position in the memory. One could also say, in the abstract, logical model of a stack of new items are piled up while elements down (as in a basement ) are incorporated in the technical, physical model of the stack.