Class Notes (1,100,000)
CA (630,000)
UW (20,000)
CS (1,000)
CS138 (10)
Lecture 11

CS138 Lecture Notes - Lecture 11: Call Stack, Modular Arithmetic, In C


Department
Computer Science
Course Code
CS138
Professor
Michael Godfrey
Lecture
11

This preview shows half of the first page. to view the full 3 pages of the document.
Data Lecture 11
February 12, 2013
Mid-term Notes
REVIEW UNIX FILE PERMISSIONS
Reference parameters are used on midterm
i=(i+1)%n
o Modular arithmetic
Comments on Pointers & Defensive Programming
With pointers, it’s easy to make subtle & hard-to-find mistakes that you discover much later in
program execution (or not at all)
Friends you need to get to know:
o Drawing diagrams
o A good debugger
o Assertions & print statements & judicious commenting
When diagnostic print statement?
At beginning/end of function call
Just after creating something “now”
Just before deleting something
At major decision point
Any time you do something interesting
When to assert?
Check that logic/assumptions are correct
o q.last==NULL if q.first==NULL
Check that “client” is being reasonable
o Check queue is non-empty before allowing pop
You're Reading a Preview

Unlock to view full version