I'm writing a program with C and this is one of my functions:
void group3()
{
char select[5];
printf("\nDetails etc.");
printf("\nPlease confirm Yes/No if you would like to subscribe:");
scanf("%s", select);
if (select == "Yes")
printf("Good.");
else
{
printf("Alright.");
main();
}
}
But when I try to compile and debug the program, a warning called "return value ignored: 'scanf'" appears. I noticed that the warning appears when I'm running scanf for integers too but the program still works for integers. However, when I try to scanf for strings, it doesn't work. I've tried using getchar() but the same warning occurs for getchar(). I've also tried using scanf_s but the same problem appears when I try to scanf_s for strings. I've also defined _CRT_SECURE_NO_WARNINGS in my program. Would really appreciate it if someone could explain to me how I can eliminate this warning from occurring/get the scanf or getchar to work with strings.
edit: thanks to some helpful users i found out that the problem isn't because the string wasn't read, but because i cannot compare strings using the if statement this way. the answer is in the comment section and i can't select it as the correct answer to this but this question is closed. thank you :)