Skip to content

Instantly share code, notes, and snippets.

@benjholla
Created October 12, 2018 16:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benjholla/ff9bbcddbf39cb8289dff0b921c72b40 to your computer and use it in GitHub Desktop.
Save benjholla/ff9bbcddbf39cb8289dff0b921c72b40 to your computer and use it in GitHub Desktop.
C Puzzle 16 (spot the bug if one exists)
#include <stdio.h>
#include <string.h>
int main(int argc, char **argv) {
char *secret = "secret";
if (argc < 2) {
printf("Usage: puzzle16 <secret>");
return -1;
}
printf(argv[1]);
if (strcmp(argv[1], secret)) {
printf(" is the secret");
} else {
printf(" is not the secret");
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment