当我运行程序并回答“是”时,它告诉我我错了。有人知道执行此类程序的方法吗?
#include <string.h>
#include <stdio.h>
int strcmp(const char *str1,const char *str2 );
// I am trying to make a program that asks the user to input an answer
int main()
{
char answer[20];
printf("Can birds fly?\n");
scanf("%s", &answer[20]);
if(strcmp(answer, "yes") == 0)
{
printf("You are right");
}else
{
printf("You are worng");
}
return 0;
}