Microsoft KB Archive/78856

= INFO: Watch Window Displays Arrays as Pointers =

Article ID: 78856

Article Last Modified on 12/12/2003

-

APPLIES TO


 * Microsoft Visual C++ 1.0 Professional Edition
 * Microsoft Visual C++ 1.5 Professional Edition
 * Microsoft Visual C++ 1.51
 * Microsoft Visual C++ 1.52 Professional Edition
 * Microsoft Visual C++ 1.0 Professional Edition
 * Microsoft Visual C++ 2.0 Professional Edition
 * Microsoft Visual C++ 2.1
 * Microsoft Visual C++ 4.0 Standard Edition
 * Microsoft Visual C++ 5.0 Standard Edition

-



This article was previously published under Q78856



SUMMARY
In the Visual Workbench Integrated Debugger, when you display an array in the Watch window, the array appears as if it was a pointer (that is, no brackets appear after the name). However, if you expand the watch value, the debugger displays all the elements of the array, not only the first element as occurs with pointers.



MORE INFORMATION
The code example below includes a character array named test. When you add a watch expression to the Watch window, the debugger displays exactly the specified expression; it does not look in the symbol table for the definition. This occurs because the Watch window allows different editing types while the Locals window does not.

If you place a watch on test, it appears in the Watch window as follows:

16-bit
  +test = 0x:0x

32-bit
  +test = 0x &quot;&quot; where each H is replaced by a hexadecimal digit and the &quot;&quot; in the 32-bit debugger is the character string (in this case, an empty string).

However, the Locals display resembles the following:

16-bit
  [BP-] +char test[20] = 0x:0x

32-bit
  [EBP-] +char test[20] = 0x &quot;&quot; The debugger searches the symbol table before it displays a value in the Locals window and shows the form above. Microsoft CodeView also searches the symbol table and displays an array as an array.

Sample Code
/* * Compile options needed: /Zi /Od */

void main(void) {  char test[20]; }

Keywords: kbinfo kbbug kbide kbdebug kbcode KB78856

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.