{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

hw7help - = CS 441 Fall 2010 JWJ Pre-class notes do not...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
CS 441 Fall 2010 -- JWJ Pre-class notes - do not distribute Tuesday, October 26, 2010 Key solution to problem 1 listed in 20101026.pdf notes ===================================== Run-time storage management Consider the following proc_block program BLOCK START MAIN var x,y,z; procedure A /*BLOCK START A*/ var x; { x:=1; y:= x*2 +1 } BLOCK END A procedure B /*BLOCK START B*/; var y; procedure C /*BLOCK START C*/; var z; procedure D /*BLOCK START D*/; var y; { x:= 1.25*z; call A; writeln(x) }; BLOCK END D { z:=1; call A; call D }; BLOCK END C { call C; writeln(x) }; BLOCK END B { x:=0; call B; write(x) }; BLOCK END MAIN Questions a) draw blocks around procedures to indicate the block structure of the program. SEE ABOVE b) what is the nesting level (largest block number)? The deepest nested block is at level 3 assuming that the initial block (main) is at level 0. c) write the execution history for this program in the form:
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

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

{[ snackBarMessage ]}

Page1 / 4

hw7help - = CS 441 Fall 2010 JWJ Pre-class notes do not...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon bookmark
Ask a homework question - tutors are online