CSC 4101 Chapter : Homework4
Document Summary
Show the run-time stack with all activation record instances, including static and dynamic chains, when execution reaches position 1 in the following skeletal program (in c-style syntax). Assume that the programming language is statically scoped but does not allow functions as return values. // position 1 void foo () { void b (int); void a () { void c () { C (); void b (int flag) { void d () { The calling sequence for this program for execution to reach c is: main calls foo, foo calls b, b calls d, d calls b, b calls a, and a calls c. What are the values of i and a[2] after function f returns if the parameter is passed by i a[2] value copy-in-copy-out reference need: (10 pts) Construct a small piece of code in c-style syntax like in the previous question that behaves differently for call-by-name and call-by-need: (10 pts)