Warning

This material has not yet been marked as "ready".

It should be treated as a "draft", i.e. a "work in progress". If this is an assignment, and this message still appears after the "assigned" date, please post a question on Piazza requesting clarification.
1
h07
CS16 W19
Name:
(as it would appear on official course roster)
Umail address: @umail.ucsb.edu section
Optional: name you wish to be called
if different from name above.
Optional: name of "homework buddy"
(leaving this blank signifies "I worked alone"

h07: Chapter 9: Dynamic memory allocation

ready? assigned due points
false Wed 02/20 09:00AM Mon 02/25 09:00AM

Submit your homework as a pdf file through Gradescope before the due date listed above. There is NO MAKEUP for missed assignments; in place of that, we drop the lowest scores (if you have zeros, those are the lowest scores.)
For best results, save this page as a pdf, then print the pdf. Please write all your answers in the provided space. Homework submitted in a format different from the provided template will receive 0 points. Please mark your homework clearly, regardless of if you write it out digitally, or in ink or pencil!


Read Chapter 6, Chapter 9, sections 9.1-9.2 (pages 508 - 533). The key learning goals are dynamic memory allocation and its use in dynamic arrays and linked-lists. Please turn in the physical copy of your homework in person. Write in PEN or DARK PENCIL.

PLEASE MARK YOUR HOMEWORK CLEARLY, REGARDLESS OF IF YOU WRITE IT OUT IN INK OR PENCIL! FOR BEST RESULTS, SAVE THIS PAGE AS A PDF, THEN PRINT THE PDF.

1.(10 pts) What is the output of the following program? Using a pointer diagram show the evolution of all data objects in memory, clearly marking elements on the run-time stack and on the heap. Mark the size of all data objects. Assume the code is embedded in a correct and complete program.