Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
Watch Value Command (5 of 5)
The Watch Value command shows a variable's name and value
in the Watch window, above the Source or Locals window. It
updates the display whenever the variable's value changes.
Unlike watchpoints, watch values do not pause execution.
You can watch a variable of any type.
■ To add a watch value, type a variable name or watch
expression in the Expression: text box. Then select
<Add/Delete>.
■ To delete a single watch value, select the expression
from the list box, then select <Add/Delete>.
■ To delete all watch values, select <Clear All>.
A watch expression may be any valid C expression.
EXAMPLES:
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
The Watch window shows variables in the default C format
for their type. To use another format, follow the variable
name with a comma and a letter from the table that follows.
Letter Format Value Display
──────────────────────────────────────────────────────────
d,i Signed decimal integer 40000 40000
u Unsigned decimal integer 40000 40000
o Unsigned octal integer 40000 116100
x,X Hexadecimal integer 40000 9c40
l,h long or short prefix for
d, i, u, o, x, X
f Signed floating-point 3./2. 1.50000
e Signed scientific-notation 3./2. 1.500000e+000
g Shorter of e and f 3./2. 1.5
c Single character 65 A
s String "Hello" "Hello"
z Structure with field names {1, 'a'} rec.a : 1
rec.b : 'a'
To display the value of a character array as a string,
precede the array name with an ampersand (&) and follow it
with an s:
&yourname,s : "John Jacob Googleheimer Smith"
Also, a character from the list can follow an expression:
rep+1,x
alps[0],f
xloc,g
count,d
NOTE: You cannot change the formatting of a long double
variable.
To watch the value at an address or the value pointed to
by a register, use the BY, WO, or DW operator. Follow
the operator with a variable, register, or constant.
■ BY returns the contents of the byte pointed to.
■ WO returns the contents of the word pointed to.
■ DW returns the contents of the doubleword pointed to.
If the BY, WO, or DW is followed by a variable, then the
environment watches the byte, word, or doubleword at the
same address as the variable.