Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- //This function matches two strings
- //as per defined by the user.
- int matchString(char input[], char match[]){
- //Check to see if the strings don't match up
- if(!strcmp(input, match)){
- //Return a bool of 0
- return 0;
- }else{
- //Return a bool of 1
- return 1;
- }
- }
- int main(int argc, char argv[]){
- //Declare variables
- char x[10];
- printf("Input: ");
- gets(x);
- //Set a string to match.
- char y[] = "Hello";
- //Check to see if matchString returns a 0 or 1.
- if(!matchString(x, y)){
- //0 Return
- printf("\nWrong.\n");
- }else{
- //1 Return
- printf("\nCorrect.\n");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement