根据C++标准,字符串字面值类型是
const char数组
。auto constStr = "aaa";
char* nonConstStr = constStr; //Error here, cannot convert from 'const char *' to 'char *'
char* stillNonConstStr = "aaa"; //Why I don't have error here?
能否请您解释一下,为什么在第三行我没有收到错误提示?