Watch Expression

The Watch Expression command displays a dialog box that adds variables and expressions to the Watch window.

A watch expression can be any valid C expression. For example, the following are all valid watch expressions in C:

count

count + 1

count + 1 == 5

For relational expressions, the Watch window shows 0 if the expression is false and 1 if the expression is true:

count + 1 == 5 : 0(False)

count + 1 == 5 : 1(True)

·To add a variable or expression to the Watch window:

1.From the Debug menu, choose Watch Expression.

2.Type a variable name or expression in the Expression text box. The default expression is the selected text or the text underneath the insertion point.

3.Choose Add.

·To delete a variable or expression from the Watch window:

1.From the Debug menu, choose Watch Expression.

2.Select the variable name or expression from the list box.

3.Choose Delete.

·To delete all variables and expressions from the Watch window:

1.From the Debug menu, choose Watch Expression.

2.Choose Clear All.

The Watch window shows variables in their default type. However, you can display variables in different formats by using special symbols. See the online reference for a list of C formatting symbols.

Related Commands

Debug menu: Quickwatch, Modify Variable Window menu: Locals

See Also

Using Watch Expressions, page 43