+ 2

In c++ when we use return 0,and without return 0 show sqme result. Why??

What is its use or difference??

28th May 2018, 3:21 PM
Preet Aman
Preet Aman - avatar
3 ответов
+ 3
A program will return a number to the operating system to tell it how the execution went. A 0 value means the execution went well, whereas a non-0 value means there was an error. For example if you run "ftp localhost" and you don't have a server, it might return a non-0 value to let the OS know it wasn't able to do what it wanted. If your main() function doesn't return a value, the compiler may return 0 by default, but it's undefined behavior.
28th May 2018, 4:02 PM
Vlad Serbu
Vlad Serbu - avatar
+ 2
any easy way for this
28th May 2018, 4:30 PM
Preet Aman
Preet Aman - avatar
+ 1
Can you attach your code here?
28th May 2018, 3:26 PM
Yugabdh
Yugabdh - avatar