Basic codes in C++ program

Asked By 0 points N/A Posted on -
qa-featured

What is the meaning of return(0) in the C++ program and what it can do to the said program?

SHARE
Best Answer by Hoting Gracia
Answered By 0 points N/A #102793

Basic codes in C++ program

qa-featured

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
Answered By 5 points N/A #102794

Basic codes in C++ program

qa-featured

 

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.
 
 

 

Answered By 0 points N/A #102795

Basic codes in C++ program

qa-featured

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.

Related Questions