Thirdnbr secondnbr firstnbr main cs 140 run time

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: gest) << smallest << endl; << middle << endl; << largest << endl; Thelast function will not alte any of thevalue of r s theincom param te ing e rs, so the passe by value y're d . Chapter 4 Page 6 What's Happening In Memory? main begins RAM x y z Data Heap Keeps track of variables in use. main calls retrieveThreeNumbers RAM The same memory is being used, but with different variable names! thirdNbr secondNbr firstNbr main CS 140 Run-Time Stack Keeps track of function calls; the function that is on top of the stack is the active function. Chapter 4 retrieveThreeNumbers main Page 7 return to main from retrieveThreeNumbers What's Happening In Memory? (Part 2) RAM y main calls reorderThreeNumbers return to main from reorderThreeNumbers RAM RAM y x z temp nbrC nbrA nbrB x z main reorderThreeNumbers main Page 8 main CS 140 Chapter 4 main calls outputThreeNumbers What's Happening In Memory? (Part 3) RAM RAM y return to main from outputThreeNumbers main ends x z largest middle smallest main outputThreeNumbers RAM main CS 140 The parameters are passed by value, so they do not share memory with main's variables! main's Chapter 4 Page 9 //////////////////////////////////////////////////////////////////////////////// // This program computes the value to which a power series converges, and the // // number of iterations required before the series can be said to converge. // /////////////////////////////////...
View Full Document

Ask a homework question - tutors are online