answersLogoWhite

0

What is return in programming?

Updated: 8/11/2023
User Avatar

Wiki User

10y ago

Best Answer

The return statement is used in functions to return control to the caller. If the function is declared non-void, the return statement also allows the programmer to return a value to the caller.

User Avatar

Wiki User

8y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

10y ago

The return keyword is used to terminate a function and return control to the calling function. In the case of the main function, control is returned to the operating system.

The syntax for a return statement is:

return [expression];

The expression must be covariant with the return type specified by the function declaration. However, class constructors, destructors and functions of type void must not specify an expression.

If an expression is expected but is not given, the return value is undefined.

A function may contain any number of return statements.

A return statement is implied when the end of a function is encountered. However, if the function returns anything other than void, a return statement must be explicitly given with a valid expression. The only exceptions are the main function which implicitly returns an int with value zero unless otherwise specified, as well as functions where the end of the function is unreachable due to the fact all possible return paths are catered for within the function body (each terminated with its own return statement).

This answer is:
User Avatar

User Avatar

Wiki User

10y ago

The return statement terminates the execution of a function and returns the control to the calling function.

return; /* Returns no value */

return result; /* Returns the value of result */

return 1; /* Returns the value 1 */

return (x * x); /* Returns the value of x * x */

It basically means it gives a value to the current function it restsinside of OR is a break point to exit the function with no value.
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is return in programming?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What is the use of return function in C programming?

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


What is void command in c sharp programming?

void simply means you don't have anything to return w/in a function, it is the same as return 0; public void sample() { MessageBox.Show("This Function do not return anything"); }


How do you make a proposal in C programming?

#include <stdio.h> int main (void) { puts ("Marry me"); return 0; }


How does the compiler differentiate the statement and function in C programming?

statement should not return a value but function returns a value


What is return means in programming?

A return statement exits the function in which it is declared and gives control to the calling code. Returning from the main function exits the program and gives control to the execution environment.

Related questions

How does return statement work in vb?

No Return statement in VB programming


What is the use of return function in C programming?

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


What an example of a function?

In C-programming: int main (void) { return 0; }


What does crlf mean?

In computer programming, cr is carriage return, lf is line feed.


What is void command in c sharp programming?

void simply means you don't have anything to return w/in a function, it is the same as return 0; public void sample() { MessageBox.Show("This Function do not return anything"); }


Will Cartoon Network return to its original programming with Cartoon Cartoon?

No.The original programming (most not all) Cartoon Network acquired to air when the network debuted as been moved to Boomerang.


How do you get decimal values in shell programming?

use $((2#<decimal value>)) eg. $((2#101001)) will return 41


How is the code return in higher programming languages like C and C converted into binary language?

By using a compiler.


How do you make a proposal in C programming?

#include <stdio.h> int main (void) { puts ("Marry me"); return 0; }


How does the compiler differentiate the statement and function in C programming?

statement should not return a value but function returns a value


What is return means in programming?

A return statement exits the function in which it is declared and gives control to the calling code. Returning from the main function exits the program and gives control to the execution environment.


How can you write a c programming which say you that day is holyday?

int main (void) {puts ("day is holyday");return 0;}