Created
July 2, 2013 02:42
-
-
Save mrkz/5906429 to your computer and use it in GitHub Desktop.
Codethical proof that 42 is the answer to the ultimate question of life, the universe and everything else.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <limits.h> | |
#define SECONDS_IN_A_YEAR 31557600LL | |
void wait(long long int seconds){ | |
while (seconds > 0){ | |
int s = seconds > INT_MAX ? INT_MAX : seconds; | |
sleep(s); | |
seconds -= s; | |
} | |
} | |
int deep_thought(){ | |
wait(7500000LL * SECONDS_IN_A_YEAR); | |
return 42; | |
} | |
int main(){ | |
printf("The answer to the ultimate question of life, the universe," | |
" and everything else is %d", deep_thought()); | |
return EXIT_SUCCESS; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment