C语言,字符串数组问题
我是如下定义的字符串数组,程序输出结果没问题,但是有waring--[Warning]deprecatedconversionfromstringconstantto'c...
我是如下定义的字符串数组,程序输出结果没问题,但是有waring--[Warning] deprecated conversion from string constant to 'char*' [-Wwrite-strings].求教如何解决waring
static char* MonthName[]={"ERROR","Jan.","Feb.","March.","Apr.","May.","June.","July.","Agu.","Sept.","Oct.","Nov.","Dec."}; 展开
static char* MonthName[]={"ERROR","Jan.","Feb.","March.","Apr.","May.","June.","July.","Agu.","Sept.","Oct.","Nov.","Dec."}; 展开
2017-04-08
展开全部
static const char* const MonthName[]={"ERROR","Jan.","Feb.","March.","Apr.","May.","June.","July.","Agu.","Sept.","Oct.","Nov.","Dec."};
更多追问追答
追问
为什么要加const?
追答
我去吃个饭先
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询