我想测试和看,“果园”类变量能否与“che”这样的固定体进行比较,以便进行比较:
#include <stdio.h>
int main()
{
char favoriteDairyProduct[30];
scanf("%s",favoriteDairyProduct);
if(favoriteDairyProduct == "cheese")
{
printf("You like cheese too!");
}
else
{
printf("I like cheese more.");
}
return 0;
}
(What I actually want to do is much longer than this but this is the main part I m stuck on.) So how would one compare two strings in C?