#include <iostream>
using namespace std;
class Mat
{
public:
int *p=NULL;
Mat(int size)
{
if (size>0)
p = new int[size];
}
~Mat()
{
if (p != NULL)
delete[]p;
p = NULL;
}
};
int main()
{
int *a= new int[4];
a[0] = 1;
a[1] = 2;
a[2] = 3;
a[3] = 4;
int **b = new int*[2];
b[0] = new int[2];
b[1] = new int[2];
b[0][0] = 1;
b[1][0] = 2;
b[0][1] = 3;
b[1][1] = 4;
Mat mat(4);
mat.p[0] = 1;
mat.p[1] = 2;
mat.p[2] = 3;
mat.p[3] = 4;
int d[] = { 1, 2, 3, 4, 5 };
}
用VS的快速监视查看数组内容。
进入调试状态后,工具栏调试中找到快速监视。
一维数组a[4], 数组名+逗号+长度

二维数组b[2][2],要按行查看内容,第一行就用b[0],2

查看类的成员变量数组,加上对象访问到成员后和普通数组一样。mat.p,4

对于栈上的数组d[5],只要数组名就会显示所有内容
原文链接
https://blog.csdn.net/sinat_36219858/article/details/80720527