char grid[3][4] = {"BWB", "WBW", "BWB"};
//或者
char grid[3][4] = {{"BWB"}, {"WBW"}, {"BWB"}};
字符数组初始化时,数组大小一定要大于字符串长度+1,否则编译错误。这是因为字符串数组最后有\0。
char grid[3][4] = {"BWB", "WBW", "BWB"};
//或者
char grid[3][4] = {{"BWB"}, {"WBW"}, {"BWB"}};
字符数组初始化时,数组大小一定要大于字符串长度+1,否则编译错误。这是因为字符串数组最后有\0。