0
How Do I Correctly use strcmp to compare the array to user input ? (What's Wrong with my Code for text input!!)
My problem: It keeps saying the strcmp() function is undeclared. #include <stdio.h> //Playing a Game of Checkers.. int main() { char user_input[4]; printf("Are you Smart? [yes or no]\n"); scanf("%s", user_input); if (strcmp ("yes", user_input) == 0) { printf("Then Go left smarty-pants :*"); } if (strcmp ("no", user_input) == 0) { printf("Then play to the Right dummy"); } return (0); }
2 Antworten
+ 1
it's fine, that warning is just letting you know that you havent included the string header file. Try adding it at the top
+ 1
Slick Thank you!!!