Hello,
I want to know how to compare a string value which is input by the user. The following code gives an error saying "Result of comparison against string literal is unspecified (use strncmp instead)".
while(valid == 0) {
printf("Yes-No-Question\n");
scanf("%s", &yesno);
valid = 1;
if(yesno != "yes" || yesno != "no") {
printf("\nERROR: Please enter yes or no.\n");
valid = 0;
}
}
I want the program to continue only if the user enters either yes or no. Any other value will keep the loop going on.
Does anyone know how to solve this?
Thanks in advance.