Asked By
0 points
N/A
Posted on - 03/18/2012
Basic codes in C++ program
Hi Rocky
Return(0) is a function in C++ that causes the main function to end. It may be followed by a code or just used at the end of the program. 0 of the return code symbolizes that the program was correct and worked as expected giving desired output. It is one of the most common ways to end a C++ program.
It is not necessary that you cannot add code after using return(0) your program can be extended beyond return(0) and the output will be the same as desired.
You can also say that it is used to exit from a function.
Best Answer
Best Answer
Basic codes in C++ program
Â
The simplest language C++ is a language that is developed from C which is a programming language that is developed at AT & T's Bell Laboratories of USA in 1972 by Dennis Ritchie who Designed and written it completely and C became popular due to its ease of use and advantages and extra features are added to C++.
Â
In every program main() deceration of syntax Void plays a major role in which it is used as it doesn't return any value at the time of compiling the program.
Â
Its good to use the return statement as you said to return the value that is needed and by default we use return(0) as the return statement for returning the value.
Â
Remind one thing that in C++ void is no more method so it does not return any value and return(0) block will call back the function after return is called and this function value is set to 0.
Â
Thank you.
Â
Â
Â
Basic codes in C++ program
This site is a cool site. Not only for technical solution.
So glad that people here help a  lot of users to understand things about software's and hardware topic..
Thanks guy,
Thank you Gracia.