views:

2082

answers:

3

If you have a statically allocated array, the Visual Studio debugger can easily display all of the array elements. However, if you have an array allocated dynamically and pointed to by a pointer, it will only display the first element of the array when you click the + to expand it. Is there an easy way to tell the debugger, show me this data as an array of type Foo and size X?

+12  A: 

Yes, simple. say you have

char *a = new char[10];

writing in the debugger:

a,10

would show you the content as if it were an array.

shoosh
+3  A: 

In a watch window, add a comma after the name of the array, and the amount of items you want to be displayed.

Drealmer
A: 

Try something along the lines of

(Foo[x])(*ptr)

May just work...

(My own experience with VC++ ended on VS2000, but try it anyway)

Arkadiy