18

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.

James McNellis
  • 348,265
  • 75
  • 913
  • 977
Nemo
  • 24,540
  • 12
  • 45
  • 61

2 Answers2

28

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].

James McNellis
  • 348,265
  • 75
  • 913
  • 977
5

You can do a memory window on that address - will show all the contents.

Martin Beckett
  • 94,801
  • 28
  • 188
  • 263