Alex Rivera | Logout

What is a stack pointer used for in microprocessors?

Asked 2009-09-23T04:56:09.260
55

I am preparing for a microprocessor exam. If the use of a program counter is to hold the address of the next instruction, what is use of stack pointer?

Edit
Report

1 Answer

6

You got more preparing [for the exam] to do ;-)

The Stack Pointer is a register which holds the address of the next available spot on the stack.

The stack is a area in memory which is reserved to store a stack, that is a LIFO (Last In First Out) type of container, where we store the local variables and return address, allowing a simple management of the nesting of function calls in a typical program.

See this Wikipedia article for a basic explanation of the stack management.

answered 2009-09-23T04:59:07.107

Your Answer