edited by
781 views

1 Answer

0 votes
0 votes
"The register that holds the address for the stack is called a stack pointer (SP)"

Depending on the environment the code is compiled in, the stack may 'grow' downward or upward. "Growing" the stack/heap simply means allocating memory from the stack/heap space for the program that requested it. In other words, SP may go from High address to Low address (Growing Downwards) or Low address to High Address (Growing Upwards) depending on the environment.

According to the question, we are performing a 'POP' operation (with SP = 5926).

So, If the stack does downwards:
High Address to Low Address, we get (5926 + 2) = 5928

If the stack does upwards:
Low Address to High Address, we get (5926 - 2) = 5924

More Explanation: https://www.youtube.com/watch?v=pOOivAJ63DM

Related questions

0 votes
0 votes
0 answers
2
ramakrushna asked Dec 28, 2021
476 views
I need help in this one.
3 votes
3 votes
2 answers
3
Kalpataru Bose asked Jul 29, 2018
621 views
Which of the following permutations can be obtained in the same order using a stack assuming that input is the sequence 5,6,7,8,9 in that order?A ) 7,8,9,5,6B ) 5,9,6,7,8...