Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
执行程序时,我正在使用此代码测试命令行中的条目。它不起作用。我应该怎么办 ?????
if(argc >1) { if (argv[1] == "b" || argv[1] == "B") {b =1;} else if (argv[1] == "h" || argv[1] == "H") { b = 0;} } else { b =0; }
您不能使用==运算符比较 c 字符串。请改用strcmp。例如 -
==
if ( (0 == strcmp(argv[1], "b") || .... )