answersLogoWhite

0

How do you use return?

Updated: 8/21/2019
User Avatar

Wiki User

7y ago

Best Answer

In C/C++ programming and most other procedural languages, you use a return statement to return control to the calling function. In the case of the global main function, a returnstatement terminates the program, releasing all memory used by the program and returning control to the execution environment.

Functions that return void do not return a value and therefore do not require a return statement, unless the function needs to return early (before falling off the end of the function). Functions that return values must use a returnstatement to return the appropriate value to the caller.

In C++ (but not in C), the global main function does not require a return statement unless returning early. When omitted, the global main function implicitly returns the value 0 (to the execution environment) when execution falls off the end of the function. To return any other value, a return statement is required.

User Avatar

Wiki User

7y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you use return?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Can you use your foreign address on your tax return?

you can not use your foreign address an a tax return


Do you have to use a return address?

It is a good idea to use a return address when sending a letter. Oftentimes, the post office will not accept a letter that does not have a return address on it.


Is the grammar correct kindly return after use?

Kindly return after use. Please return after use. Both examples above seem to be correct grammar.


How do you use return function?

return;orreturn ;PS: not function, statement!


What is the use of return in function in c?

To return the exp. or const to the main fumction.


Why use void in main of java?

No. void is not a data type. It is mandatory for all java methods to return something and if it is not going to return anything, we have to mark the method with a "void" return type to let the JVM know that it must not expect anything from the method.


What is the use of return function in C programming?

To return the exp. or const to the main fumction.


Can I return a used car to the dealership if it wasn't what I thought?

Can I return a use car


What Movie titles have the word 'return' in it?

A lot of sequels use the word "return": Return of the Jedi, The Lord of the Rings: The Return of the King, The Return of the Living Dead, Return to Oz, Cocoon: The Return, Batman Returns, Return of the Seven, Return to the Blue Lagoon, Return to Witch Mountain. Here are a few non-sequels: Return to Me, Return to Paradise, Return of the Secaucus Seven, Point of No Return, River of No Return.


Can you use printf as a return value?

No, it is a function. But printf does return a value: the number of characters it has written.


Where do you use no argument no return in c function?

Where there is no need to return any type of value from a function


Where can I use the tax return software for free?

If you are wondering whether or not you can use the tax return software for free because a lot of the consumers do it, then the answer would be that there is no way.