How can I do an if check if the typed word is equal to some word in a string list in C? Example:
#include <stdio.h>
int main(){
char input[20];
char* strings[] = {"apple","banana"};
printf("try to hit one of my favorite fruits:\n");
scanf("%s", input);
if(input == strings[]){
printf("you got it right %s is one of my favorite fruits!", input);
}else{
printf("you missed");
}
}
Aucun commentaire:
Enregistrer un commentaire