Nesting Instinct

After that (theoretically) instructive anecdote, it's time to get back to our regularly scheduled text, where we were examining the function of the stack in storing information needed during execution of a function. The next statement in our example program (Figure 5.5 on page 235) is Result = (First + Second) / 2;. Since we've assumed that First is 2, and Second is 4, the value of Result will be (4+2)/2, or 3. After this statement is executed, the stack looks like Figure 5.28.

Figure 5.28. The stack after the initialization of Result

Finally, at the end of the function, the stack pointer will be incremented to point to the ...

Get Learning to Program in C++ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.