我正在尝试使用 main() 参数向量来获取三个选项,它会输出所有三个结果。为什么它不能工作?
#include <ctype.h>
#include <stdio.h>
void output_1(char *str);
void output_2(char *str);
void output_3(char *str);
int main(int argc,char *argv[])
{
char str[40];
gets(str);
if (argv[1]="-p")
{
output_1(str);
}
if (argv[1]="-u")
{
output_2(str);
}
if (argv[1]="-l")
{
output_3(str);
}
}
output_1/2/3 的定义无关紧要。