For some reason, my code isn’t working in C.
Please check the code below:
#include <stdio.h>
int main(){
printf(“Do you want to play? “);
char play[3]; //accepting to a maximum number of 3 letters from the user
scanf(“%s”, &play);
if (play == “yes”){
printf(“Okay, let’s go”);
} else if (play == “no”){
printf(“Alright, bye! “);
} else {
printf(“Invalid Input”);
} //When I run it, it always gives me “invalid input” even when it’s supposed to print either of the if commands
}
Aucun commentaire:
Enregistrer un commentaire