Got a small question 😁(Difference)? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Got a small question 😁(Difference)?

Here is a code of C... #include <stdio.h> /* A simple C program * Version 1.0 */ int main() { /* Output a string */ printf("Hello World!"); return 0; } What is the reason for including return 0 on it👆,and this same code also works fine without the return 0 also works....so what is the purpose of including return 0...

5th Oct 2021, 3:54 AM
•Đคяк รтяεคм 𝅘𝅥𝅮 ᴺ•ᵀ•ᴬˢᵘʳᵃᵖᵖᵘˡᶦ
•Đคяк รтяεคм 𝅘𝅥𝅮 ᴺ•ᵀ•ᴬˢᵘʳᵃᵖᵖᵘˡᶦ - avatar
3 Answers
+ 1
A successful program returns a 0, non-zero value means failure. Yp you can run the main function without the return 0. It works the fine. But it's a good practice to follow.
5th Oct 2021, 4:30 AM
Rusiru Rathmina
Rusiru Rathmina - avatar
+ 1
Ok thanks 👍
17th Oct 2021, 11:45 AM
•Đคяк รтяεคм 𝅘𝅥𝅮 ᴺ•ᵀ•ᴬˢᵘʳᵃᵖᵖᵘˡᶦ
•Đคяк รтяεคм 𝅘𝅥𝅮 ᴺ•ᵀ•ᴬˢᵘʳᵃᵖᵖᵘˡᶦ - avatar