The watch window provides a means to evaluate expressions and display the values of those expressions. Typically expressions are just the name of the variable to be displayed, but can be considerably more complex see debugger expressions. Note that the expressions are always evaluated when your program stops so the expression you are watching is the one that is in scope of the stopped program position.

## Watch window user interface

The Watch window is divided into a tool bar and the main data display.

###### Watch tool bar

Button | Description
| Displays the selected item in binary.
| Displays the selected item in octal.
| Displays the selected item in decimal.
| Displays the selected item in hexadecimal.
| Displays the selected item as a signed decimal.
| Displays the selected item as a character or Unicode character.
| Sets the displayed range in the active memory window to the where the selected item is stored.
| Sorts the global variables alphabetically by name.
| Sorts the global variables numerically by address or register number (default).

## Using the Watch window

Each expression appears as a row in the display. Each row contains the expression and its value. If the value of an expression is structured (for example an array) then you can open the structure see its contents.

The display is updated each time the debugger locates to source code. So it will update each time your program stops on a breakpoint or single step and whenever you traverse the call stack. Items that have changed since they that were previously displayed are highlighted in red.

###### Showing the Watch window

To display watch window n if it is hidden, do one of the following:

- From the View menu, click Other Windows then Watch n.

—or—

- From the Debug menu, click Debug Windows then Watch n.

—or—

- Type Ctrl+T, W, n.

—or—

- Right click the tool bar area to display the View menu.
- From the popup menu, click Other Windows then Watch n.

######

###### Changing display format

When you select a variable in the main part of the display, the display format button highlighted on the Watch window tool bar changes to show the item’s display format.

To change the display format of a local variable, do one of the following:

- Right click the item to change.
- From the popup menu, select the format to display the item in.

—or—

- Click the item to change.
- On the Watch window tool bar, select the format to display the item in.

The selected display format will then be used for all subsequent displays and will be recorded when the debug session stops.

For C programs the interpretation of pointer types can be changed by right clicking and selecting from the popup menu. A pointer can be interpreted as:

- a null terminated ASCII string.
- an array.
- an integer.
- dereferenced.

###### Modifying watched values

To modify the value of a local variable, do one of the following:

- Click the value of the local variable to modify.
- Enter the new value for the local variable. Prefix hexadecimal numbers with ‘0x’, binary numbers with ‘0b’, and octal numbers with ‘0’.

—or—

- Right click the value of the local variable to modify.
- From the popup menu, select one of the operations to modify the variable’s value