Computer Science 340
Programming Languages
Fall 2019, Siena College
Lecture 22: Control Structures
Date: Wednesday, October 30, 2019
Agenda
- Announcements
- Language Project
[HTML]
[PDF]
- all groups should now be formed and repositories created
- Problem Set 5: [HTML] [PDF] is on the late clock
- Finish reading Sebesta Ch. 8 if you have not already done so
- Problem Set 6: [HTML] [PDF] out
- Quick mini "lab" exercise for 10 easy points
Consider the following memory allocation
of linked lists. head and ptr are stack (local) variables
that point to list nodes. List nodes were allocated in heap memory,
and each list node consists of a value (an int) and a pointer to
another list node. A /
through a pointer field indicates a
null pointer.
- If a garbage collection operation executes, what memory
can be reclaimed?
- If the head variable goes out of scope and a garbage
collection operation executes, what memory can be reclaimed?
- Control Structures
Terminology
- control structures
- selection statement
- conditional statements
- dangling else
- counter-controlled/logic-controlled loops
- initial/terminal/step values
- discrete range
- pre-test/post-test loops
- iterator
Examples
- switch
- gotoloops
- iterable
Links