I am trying to use Visual Studio's debugging features more effectively; I certainly do not know all its ins and outs.

At the moment, I would like to quickly see the values of an array.

See the attached screenshot of the Watch Window.
The variable k is a global array of type double variables; during the present execution, it contains 5 entries.
I have stepped through the program into a sub-routine and would like to see the present values of k's entries.
If I add a watch (Cntrl-D, Q) for k, the address for k and its first entry only are shown.
To see the values of the other four entries, I had to manually add a watch for each entry: k[0], k[1], k[2], etc.
There must be an easier way to do this. I'd simply like to click on the variable in the Watch window, expand it, and view all the values of the array entries. Adding watches manually, especially for larger arrays, could get tedious.

Am I overlooking a setting in the IDE?

Any and all advice is appreciated.

Edited by DavidB

Attachments Image_of_Watch1.PNG 12.19 KB
3 Years
Discussion Span
Last Post by DavidB

The only way I know to do that is to move the cursor on the array name then an + will appear, select the + and it will show all array elements. You can even do that for linked lists, but only one node at a time. It doesn't work like that for pointers to arrays.


When in the debugger, did you already try to hover over a variable in the source with your mousepointer?


AD: Do you mean in the Watch Window? That is what I would like to do, and what I tried to do (see the image attached to my first post). It didn't expand to all the array elements.

ddanbe: Attached is another image. This one shows the mouse over the variable, and I tried to click on it, to make it expand, but didn't get any further.

Attachments Image_of_Watch_2.PNG 4.57 KB

This one shows the mouse over the variable, and I tried to click on it, to make it expand,

It won't expand if the variable is just a pointer because the debugger has no idea how many elements are in the array, or even if it is an array at all.

But if it's an array and not a pointer than click the + that's in the box just before the variable name.

AD: Do you mean in the Watch Window?


Edited by Ancient Dragon


Okay, I have played around with it a little more.
The fact that the arrays are global seems to be affecting the behaviour. All arrays declared local to the function, or passed in as usual, behave as expected (i.e. - I can watch all entries as usual).

I am going to mark this thread "Solved" and move on.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.