Outline for June 3, 2002

Handouts:Sample Final Reading: none


  1. Greetings and felicitations!
  2. Static debugging
    1. using printf to print variable values; mention %p (prints pointer value, usually as a hex integer)
    2. using printf to print where you are (ie, on function entry printf("in function\n");
    3. #ifdef DEBUG ... #endif around the printfs so you can leave them in the source if you need them again
    4. assert(x) macro: assert(0 <= i && i <= n) causes program to exit with error message if (0 <= I && I <= n) is false; must include <assert.h>. To delete, say #define NDEBUG and they will not be in the compiled code.
  3. Dynamic debugging
    1. debugging tool instruments executable program so it can be stopped, examined, altered, and continued interactively
    2. go through the handout
    3. mention the "where" command which shows you the program stack

ECS 30-A, Introduction to Programming
Winter Quarter 2002
Email: [email protected]