i am trying to learn c and i want to make a yesno with a single char. here is my code:
i have tried this
#include <stdio.h>
#include <stdlib.h>
//just playing
int main()
{
char yesno;
printf("TEST [Y/n] ");
scanf(" %c", &yesno);
if(yesno == "y") {
printf("You did yes!!");
} else if(yesno == "n") {
printf("You did no!");
} else {
printf("Not valid!!!");
}
return 0;
}
and it skips to else automatically why is this
update: i did not know that this is a duplicate. idk what double quotes were and singles were before