Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Watching a C++ array in Visual Studio [duplicate]

I have declared an array as follows:

int *arr;

Is there any way in visual studio to watch all the elements of the array while debugging, rather than having to manually place watch for an element *(arr+1), *(arr+2) and so on.

like image 267
Nemo Avatar asked Feb 04 '11 21:02

Nemo


1 Answers

If arr is a pointer to an array of ten integers, you can add "arr,10" to the watch window and when you expand it it will show the ten elements [obviously, you can replace the 10 with whatever the length of your array is].

like image 128
James McNellis Avatar answered Oct 06 '22 02:10

James McNellis