Box-and-Pointer Exercise

Instructions:

Do the following. If there is ANYTHING that you do not COMPLETELY understand, bring your questions to class.

  1. Open this Paper-and-Pencil Exercise on Box-and-Pointer Diagrams, which we will hereafter call the document.

    • Print the document if you can reasonably do so. Otherwise, make it visible on your screen.
    • Do NOT begin the exercise yet! You will work through the document page by page, watching videos to check your answers as you do so, per the following instructions.
  2. First, watch this video that introduces Problem 1 of this Box-and-Pointer exercise, reading page 1 of the above document as you do so.

  3. Now, do Problem 1 of the exercise, on page 2 of the document.

    • Do NOT proceed past Problem 1 yet — do only Problem 1 and then continue in these instructions.
  4. Next, watch this video that works through the solution to Problem 1 of this Box-and-Pointer exercise.

    • Check your solution to Problem 1 as you do so.
    • If you have questions about the solution, GET HELP BEFORE PROCEEDING, by using Live Now! or other means.
  5. Now, do Problem 2 of the exercise, on page 3 of the document.

    • Do NOT proceed past Problem 2 yet — do only Problem 2 and then continue in these instructions.
  6. After you have completed Problem 2, watch this video that works through the solution to Problem 2 of this Box-and-Pointer exercise.

    • Check your solution to Problem 2 as you do so.
    • If you have questions about the solution, GET HELP BEFORE PROCEEDING, by using Live Now! or other means.
  7. Next, read page 4 of the document.

    • Read carefully!

    • Note especially that calling a function causes the following:

      • Boxes for the parameters of the function come into existence.
      • Arrows are drawn from these boxes in the FUNCTION DEFINITION back to the boxes for the arguments in the CALLER of the function.

      See the purple arrows at the bottom of page 4, noting that they are drawn from the namespace for the called function foo BACK TO the namespace for the caller (which is main in this case).

    • Again, READ PAGE 4 CAREFULLY!

  8. Now, do Problem 3 of the exercise, on page 5 of the document.

    • Do NOT proceed past Problem 3 yet — do only Problem 3 and then continue in these instructions.
  9. After you have completed Problem 3, watch this video that works through the solution to Problem 3 of this Box-and-Pointer exercise.

    • Check your solution to Problem 3 as you do so.
    • If you have questions about the solution, GET HELP BEFORE PROCEEDING, by using Live Now! or other means.
  10. Now, do Problem 4 of the exercise, on page 6 of the document.

  11. After you have completed Problem 4, watch this video that works through the solution to Problem 4 of this Box-and-Pointer exercise.

    • Check your solution to Problem 4 as you do so.
    • ASK QUESTIONS by using Live Now! or other means.

For your reference, here is a printed SOLUTION to the Paper-and-Pencil Exercise on Box-and-Pointer Diagrams that you have just completed.

If there is ANYTHING that you do not COMPLETELY understand from this exercise, bring your questions to class.