122k views
6 votes
Give me two reasons why return statements are used in code.

User MRX
by
4.0k points

2 Answers

7 votes

Step-by-step explanation:

The C language return statement ends function execution and ... the calling function at the point immediately following the call. ... For more information, see Return type.

User Jacob Jedryszek
by
4.8k points
9 votes
It can stop the function when it’s no longer needed to keep running

And it can give a certain value to send back so it can be used elsewhere in your code
User Maryclare
by
4.5k points