char* test3[5]={
"hello word!",
"nihaoaa",
"woshizuichangde",
"yiyiyiyiy",
"jijijiji"
};
像这样定义会出现
C++ warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] 错误
是因为
在C++中字符串文字是常量字符数组。
在定义的时候 加上const 就可以避免warning.
const
char* test3[5]={
"hello word!",
"nihaoaa",
"woshizuichangde",
"yiyiyiyiy",
"jijijiji"
};