demon90s / CppStudy

My study notes for c/cpp language
https://demon90s.github.io/CppStudy/
156 stars 65 forks source link

c语言程序设计 : ch08 数组--- 数组越界? #2

Closed Langdon-Chen closed 4 years ago

Langdon-Chen commented 5 years ago

原文如下

多维数组初始化 通过嵌套一维数组的方法可以产生二维数组的初始化式: int a[2][3] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};

上面的数组已经越界了吧

demon90s commented 5 years ago

是的,应该改成 a[3][3], 这是初始化,编译器也会抱怨的