Skip to content

Instantly share code, notes, and snippets.

@winstonewert
Created November 24, 2015 18:38
Show Gist options
  • Save winstonewert/cff27cda090d518506fa to your computer and use it in GitHub Desktop.
Save winstonewert/cff27cda090d518506fa to your computer and use it in GitHub Desktop.
#include <stdlib.h>
#include <string.h>
#define false 0
#define true 1
typedef int bool;
bool error(int depth) {
if(depth == 0) {
return true;
} else {
if (!error(depth-1)) return false;
if (!error(depth-1)) return false;
if (!error(depth-1)) return false;
if (!error(depth-1)) return false;
if (!error(depth-1)) return false;
if (!error(depth-1)) return false;
}
return true;
}
void no_error(int depth) {
if(depth == 0) {
return;
} else {
no_error(depth-1);
no_error(depth-1);
no_error(depth-1);
no_error(depth-1);
no_error(depth-1);
no_error(depth-1);
}
}
int main(int argc, char **argv) {
int depth = atoi(argv[1]);
if (strcmp(argv[2], "e") == 0) {
error(depth);
} else {
no_error(depth);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment