English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

2006-11-24 22:40:32 · 2 answers · asked by james r 1 in Computers & Internet Programming & Design

2 answers

Are you talking about "the stack" or "a stack"? If you're referring to "a stack" then it's an abstract data structure whose operations are to "push" an item on top of the stack and to "pop" and item off the top. Think of a laundry hamper, where you "push" a pair of jeans on top at night, then you realize you don't have any clean pants in the morning so you "pop" the first pair off the top of the hamper.

"The stack" usually refers to the processor stack. CPUs have stacks and opcodes for accessing them. In C, the stack is used to pass values during function calls. When a function is called, the address of the next instruction after the call is pushed onto the stack, then all of the parameters. The function then pops the parameters off the stack, and then pops the return address to know where to go when it hits a return statement.

2006-11-24 23:21:04 · answer #1 · answered by watsonc64 3 · 1 0

As in real life a stack is a cylinderical or conical wharehosuse where u keep items. Same its in "C" stack is a virtual database created in the RAM to hold ur data for the run time of programme. It can also be called as a virtual data base. The main rule for this is LIFO (Last in first out) based, means the last item u added will come first out of the data base. Same as in the real life stack.

This is a part of Data Structure.

2006-11-25 07:02:19 · answer #2 · answered by khem_2k786 2 · 0 0

fedest.com, questions and answers