Can we write return 1 or 2 or any number instead of return 0; | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

Can we write return 1 or 2 or any number instead of return 0;

I tried this and there is no difference 😅

4th Jul 2021, 5:15 PM
Sundaram Kumar
Sundaram Kumar - avatar
1 Answer
+ 3
If you using int main then its necessary to use return statement but its not necessarily to write return 0 . You main can written any Integer values if it is 1 2 or anything . You can also use return EXIT_SUCCESS; for successful compilation same for EXIT_FAILURE its a long story how it came in windows for now u cam use this also
4th Jul 2021, 6:32 PM
A S Raghuvanshi
A S Raghuvanshi - avatar