diff --git a/challenge/challenge.c b/challenge/challenge.c new file mode 100644 index 0000000..70c9443 --- /dev/null +++ b/challenge/challenge.c @@ -0,0 +1,30 @@ +#include +#include + +int main() { + int bytes_read; + size_t nbytes = 10; + char **my_string = malloc(sizeof(char**)); + char *password = "23door42\n"; + + puts("Please enter Password: "); + + bytes_read = getline(my_string, &nbytes, stdin); + + if(bytes_read == -1) { + puts("Error"); + return -1; + } else { + puts(password); + puts(*my_string); + if (strcmp(*my_string, password) == 0) { + puts("Success"); + return 0; + } else { + puts("How about no?!"); + return -1; + } + } + + return 0; +}