Unlike high-level-language compilers, MASM does not provide symbolic information for arrays. Consequently, CodeView cannot distinguish between a simple variable and an array, and therefore cannot directly display an assembly-language array in expanded form. (See Section 15.3.2, “Displaying Expressions in the Watch Window,” to display individual array elements.)
Summary: A user-defined pointer lets you view an expanded array.
For debugging purposes, you can overcome MASM's lack of array information by using the TYPEDEF directive to define a pointer type, and from that a pointer variable for the array. (Place the directive and pointer definition within a conditional-assembly block, so the pointer won't be added to your release code.) You can then view the array from CodeView by placing the pointer in the Watch window. For example:
array BYTE 20 DUP (0) ; array of 20 bytes
IF debug
PBYTE TYPEDEF PTR BYTE ; PBYTE type is pointer to bytes
parray PBYTE array ; parray points to array
ENDIF
If you declare multiple levels of pointers (pointers to pointers to pointers, and so on), multiple levels of indirection can be displayed simultaneously by expanding each subpointer.
If it is inconvenient to view a character array in hexadecimal form, cast the variable's name to a character pointer by placing (char *) in front of the name. The character array is then displayed as a string delimited by apostrophes. You can also append the string-format specifier ,s to the expression.
Note that the C expression evaluator expects a string to terminate with the ASCII null character (0). If you do not include a terminating null in the string's definition, the evaluator continues displaying memory as characters until it encounters a null. The Memory window is an effective way to view nonterminated strings.