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

asked
User MRX
by
7.8k 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.

answered
User Jacob Jedryszek
by
8.6k 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
answered
User Maryclare
by
8.6k points

No related questions found