假设我有一个字符数组,这是可以的:
char myChars[100] = "hello";
但是如果我有一个
const char* hello="hello";
char myChars[100] = hello;
或者
const char hello[6]="hello";
char myChars[100] = hello;
不允许这样做:
error: array must be initialized with a brace-enclosed intializer
似乎这些语句基本等价,为什么会这样?
const char myChars[] = "Hello";
吗? - Thomas Matthews