The Watch window displays the value of program variables or the value of expressions you specify in a high-level language. For each expression or variable, you can change the format of the data that is displayed. You can expand aggregate variables, such as structures and arrays, to show all the elements of an aggregate and contract them to save space in the Watch window. You can follow chains of pointers to display and help debug more complex structures, such as linked lists or binary trees.
To open a Watch window, use one of the following methods:
From the Windows menu, choose Watch.
In the Command window, type the Add Watch (W?) command followed by the variable or expression name.
Press ALT+2.
To add expressions to the Watch window, use the Add Watch command from the Data menu or the Quick Watch dialog box (SHIFT+F9). You can also add watch expressions using the Add Watch (W?) and Quick Watch (??) commands.
Note:
Do not edit a string in the Watch window.
Summary: Type new values for variables in the Watch window.
To change the value of any variable displayed in the Watch window, move the cursor to the value, delete the old value, and type the new value. To change the format in which a variable is displayed or to specify a new format, move the cursor to the end of the variable name and type a new format specifier.
To toggle between insert and overtype modes, press the INS key.
For information on expanding and contracting aggregate types and following pointers, see the “Quick Watch” command on page 478. For detailed information on specifying and using watch expressions, see the “Codeview Expression Reference” and Chapter 11, “Using Expressions in CodeView.”