I found a nice example of how to use strcmp, but it\'s only working with fgets(), and i need to make it work with scanf. So, here\'s the code:
int main(void) {
c
Scanf will ignore "\n", so you should init char fruit[] = "apple"
, since ans will never end with '\n'.
P.S: An explain for scanf: Any number of non-whitespace characters, stopping at the first whitespace character found. A terminating null character is automatically added at the end of the stored sequence.