c语言关于复制二维数组的问题

在晚上

#include <stdio.h>
#include <string.h>
int main()
{
    int chest[2][2] = { {1, 2}, {1, 2} };
    int chest_1[2][2] = { 0, 0 };
    memcpy(chest_1, chest, sizeof(chest));
}

这样复制后,调试情况

img

出错了

我的解答思路和尝试过的方法
我想要达到的结果

首先我不知知道为什么会有chest_1[7],这样的操作,你定义了一个两行两列的数组,然后去寻找他的第七行,这里我表示无法理解,当然,看你的操作应该是想把一个数组的元素拷贝到另一个数组里面去,当然操作没有问题,但是可能你对二维数组的理解有些问题;

#include <stdio.h>
#include <string.h>
int main()
{
    int chest[2][2] = { {1, 2}, {1, 2} };
    int chest_1[2][2] = { 0, 0 };
    memcpy(chest_1, chest, sizeof(chest));
    printf("%d", chest_1[1][1]);
    return 0;
}

该程序输出结果是2,如果你还有哪里不会可以私信问我哦!

chest_1 换成以下声明,可否?
int chest_1[2][2] = { {0, 0 }, {0, 0 }};