#define MAX_RECURSIONS 40 ... if(rec > MAX_RECURSIONS){  fprintf(stderr, "Too many recursions (" #MAX_RECURSIONS ")\n");  exit(1); }