一个小小的问题,关于结构体的
当定义一个结构体,像这样的struct l{
int L[6];
int length;
}n;
若到达n.L[6],溢出啦,那么length的值是否也会改变?
程序代码:#include<iostream>
#include<string>
using namespace std;
struct tagStruct
{
tagStruct()
{
nLength = sizeof(nAry);
memset(nAry, 0, nLength);
}
int nAry[6];
int nLength;
}Test;
void main()
{
int nAry[3][3] = {{1, 2, 3}, {4, 5, 6},{7, 8, 9}};
memcpy(Test.nAry, nAry, sizeof(nAry));
}