为什么a=0;用strcmp();

#include <stdio.h>

int main()
{
int a=0;
char x[10];

scanf("%s",x);

#if(1)
if(x=="www")
{
a++;
}
#endif
#if(0)
if(strcmp(x,"www"==0)
{
a++;
}
#endif
printf("%d",a);
return 0;
}

  1. 为什么a=0这个没太懂你想问啥,按照代码里的int a=0就是申请一个变量赋初值的操作,初始值为0,你也可以设置成其他
  2. strcmp是字符串函数,用于对比两个字符串是否相等,相等返回 0, 不相等返回 非 0