誰かが私にここの問題を指摘できますか? これはコンパイルされますが、何も出力されません。コマンドライン引数の文字列を文字列「hello」と比較する必要があります。ありがとう!
#include <stdio.h>
#include <string.h>
int main(int argc, char *argv[])
{
if (argc == 0)
{
printf("No arguments passed!\n");
}
char *str = argv[1];
if(strcmp("hello", str)==0)
{
printf("Yes, I find it");
}
else
{
printf("nothing");
}
return 0;
}