From 201e9b0eae51782dbb9819da77c4bae1705eb16a Mon Sep 17 00:00:00 2001 From: Nick Chambers Date: Thu, 13 Jan 2022 12:43:06 -0600 Subject: [PATCH] Move the 'not' operator to the proper location --- c/cosmic.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/c/cosmic.c b/c/cosmic.c index 1cac97a..bcc6123 100644 --- a/c/cosmic.c +++ b/c/cosmic.c @@ -1,5 +1,3 @@ -#include - int match(const char *needle, const char *haystack) { while(*haystack) { if(*needle == '*' && *(needle + 1) == '*') { @@ -20,7 +18,7 @@ int match(const char *needle, const char *haystack) { } } - return *needle != '\0'; + return *needle == '\0'; } int main(int argc, char **argv) { @@ -28,5 +26,5 @@ int main(int argc, char **argv) { return 1; } - return match(argv[1], argv[2]); + return !match(argv[1], argv[2]); }