What happens if i didn't write return 0; at the end of my program ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

What happens if i didn't write return 0; at the end of my program ?

Return 0;

17th Jun 2019, 3:38 PM
The unknown 321
The unknown 321 - avatar
8 Answers
+ 2
I know. But I wanted to delete the return 0 to see if something will change. But nothing happened .
17th Jun 2019, 3:42 PM
The unknown 321
The unknown 321 - avatar
+ 1
Dude. If I deleted the return 0 and my program ran Normally then why would I use it ?
17th Jun 2019, 3:48 PM
The unknown 321
The unknown 321 - avatar
+ 1
If I'm confident that my program will misbehave I don't write it. Then most of my programs will misbehave from the first time because of some mistakes will this mean that I don't permanently write a program again because of some mistakes ?
17th Jun 2019, 4:08 PM
The unknown 321
The unknown 321 - avatar
+ 1
Thanks for the information.as for the last couple of lines. Well your reply made me say the last couple of lines. Because every program must have some errors. Big programs especially. That's what I was trying to clarify about misbehaving of program.you see..If you saw programmers. A lot of us think that they don't make single mistake when one program contains more than one or more mistakes. And your telling me that if my program misbehaved then i shouldn't write it. That's what I was trying to clarify.
17th Jun 2019, 4:59 PM
The unknown 321
The unknown 321 - avatar
+ 1
I didn't say that return 0 is not important and what i meant by i shouldn't write it in the reply i didn't mean that i shouldn't write it permanently as I mentioned in the first reply of you saying the misbehave thing. what i said for the return 0 is why I would write it if without it my program will still work that's what i know about the return statement
17th Jun 2019, 5:29 PM
The unknown 321
The unknown 321 - avatar
+ 1
Did I say that return statement is not important ?
17th Jun 2019, 6:08 PM
The unknown 321
The unknown 321 - avatar
+ 1
That's what i just said when I asked the question the program will work fine without it. I didn't say it isn't important what I said is that my program will work fine without it that's what i exactly wanted to say.
17th Jun 2019, 6:15 PM
The unknown 321
The unknown 321 - avatar
+ 1
Yeah i said why should I write it but didn't say it isn't important and that's what I wanted to know is that why my program works fine without it thanks to your explanation I understood.Thanks for your awesome explanation as always.
17th Jun 2019, 6:34 PM
The unknown 321
The unknown 321 - avatar