在Visual Studio中观看C ++数组[重复]

时间:2022-07-15 03:15:07

This question already has an answer here:

这个问题在这里已有答案:

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.

在Visual Studio中有什么方法可以在调试时观察阵列的所有元素,而不必手动为元素*(arr + 1),*(arr + 2)等设置监视。

2 个解决方案

#1


27  

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

如果arr是一个指向十个整数数组的指针,你可以在监视窗口中添加“arr,10”,当你展开它时,它会显示十个元素[显然,你可以用你的数组的长度替换10是。

#2


5  

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

您可以在该地址上执行内存窗口 - 将显示所有内容。

#1


27  

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

如果arr是一个指向十个整数数组的指针,你可以在监视窗口中添加“arr,10”,当你展开它时,它会显示十个元素[显然,你可以用你的数组的长度替换10是。

#2


5  

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

您可以在该地址上执行内存窗口 - 将显示所有内容。