What is the right termination of a C++ program? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 1

What is the right termination of a C++ program?

I am terminating the 'Hello World' program with any value and it is running successfully. What is the right termination? https://code.sololearn.com/cfJcA6A9KPlm/?ref=app

19th Oct 2017, 4:04 AM
Arka Banerjee
Arka Banerjee - avatar
1 Resposta
+ 3
If you're referring to the value after "return", it doesn't matter what you return unless you have another program waiting to receive the exit value of this process. Say, for example, if you had this program return 0 if terminated successfully and 1 if something goes wrong, a separate process could be waiting for this one to finish so it could then do X or Y depending on the successfulness of this process. That stuff is pretty far down the road though, so basically, you can return any int.
19th Oct 2017, 4:40 AM
Taylor Davison
Taylor Davison - avatar