问题描述
我正在尝试检查我传递的 char** 历史是否包含特定单词,以便我可以决定结果:
这段代码总是跳转到 else,所以我认为我的 if 语句不起作用,有什么想法吗?
void myHistory(char** history) {
if ((strchr(history,'-c') != NULL)) {
printf("Clear History\n");
}
else if ((strchr(history,'-e')) != NULL) {
printf("Execute History\n");
}
else{
int loop=0;
for(loop=0; loop< 20; loop++)
{
printf("[%d]: %s\n",loop+1,history[loop]); // print the history along with number
}
}
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)