我收到来自 gcc 编译器的警告,显示 const char 问题。
如何摆脱警告?
谢谢,迈克尔
char * str_convert(int op) {
/*returns the string corresponding to an operation opcode. Used for screen output.*/
if(op == PLUS) {
return "plus";
}
else if (op == MULT) {
return "mult";
}
else if (op == SUBS) {
return "subs";
}
else if (op == MOD) {
return "mod";
}
else if (op == ABS) {
return "abs";
}
else if (op == MAX) {
return "max";
}
else if (op == MIN) {
return "min";
}
else {
return NULL;
}
}