+ 1
Why does the hello world program works even after replacing return 0 with return 2 or return 5?
#include <stdio.h> int main() { printf("Hello, World!\n"); return 2; } #include <stdio.h> int main() { printf("Hello, World!\n"); return 5; }
2 Answers
+ 1
Some operating systems check the return value and will behave differently based on it. Normally, it is used in scripts or programs to do extra error processing after your code completes.