How to display a dynamically allocated array in the Visual Studio debugger? How to display a dynamically allocated array in the Visual Studio debugger? c c

How to display a dynamically allocated array in the Visual Studio debugger?


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.


There are two methods to view data in an array m4x4:

float m4x4[16]={    1.f,0.f,0.f,0.f,    0.f,2.f,0.f,0.f,    0.f,0.f,3.f,0.f,    0.f,0.f,0.f,4.f};

One way is with a Watch window (Debug/Windows/Watch). Add watch =

m4x4,16

This displays data in a list:

enter image description here

Another way is with a Memory window (Debug/Windows/Memory). Specify a memory start address =

m4x4

This displays data in a table, which is better for two and three dimensional matrices:

enter image description here

Right-click on the Memory window to determine how the binary data is visualized. Choices are limited to integers, floats and some text encodings.


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