From the course: Debugging C Code
Unlock this course with a free trial
Join today to access over 24,800 courses taught by industry experts.
Examining variables and memory - C Tutorial
From the course: Debugging C Code
Examining variables and memory
- [Instructor] A most useful debugging tool is to observe the values of variables and the contents of memory as your program runs. Set a break point where the action starts at line eight in this code, run and debug. The variables area shows variables declared in the code, a string of 22 bytes. You can see the strings contents here, and variable X initialized to zero. In the watch area, I'm going to add an expression to watch. Click the plus icon. Type any valid C language expression such as string X, enter, and you see the value of that expression. With variable X equal to zero, string X references the letter G code 71 decimal element zero in the array. As I step through the code, you can see what happens to this value. Variable X increments, and the next element in the array is referenced. Remember to step over the putchar function. I'm just stepping over everything here, which also works. Because of buffering, no text is output and I'll run the rest of the code just to see what…