Why return 0; is mostly used in C?? Is there any specific reason behind this? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why return 0; is mostly used in C?? Is there any specific reason behind this?

5th Dec 2021, 8:24 PM
Sadiqul Bashar
Sadiqul Bashar - avatar
2 Answers
+ 1
With the new standard of C return 0; Is not required for main() int main(void) { some code; } Is valid (given your code is valid). The reason 0 was used it's the only number that does not have a positive and negative value thus has only a single state. Return 0 was defined as success to main.
6th Dec 2021, 2:25 AM
William Owens
William Owens - avatar