Should a function contain a return statement if it does not return a value? Ans. In C, void functions (those that do not return a value to the calling function) are not required to include a return statement. Therefore, it is not necessary to include a return statement in your functions declared as being void. In some cases, your function might trigger some critical error, and an immediate exit from the function might be necessary. In this case, it is perfectly acceptable to use a return statement to bypass the rest of the function's code. However, keep in mind that it is not considered good programming practice to litter your functions with return statements-generally, you should keep your function's exit point as focused and clean as possible. - Study24x7
Social learning Network
22 Mar 2023 11:59 AM study24x7 study24x7

Should a function contain a return statement if it does not return a value? Ans. In C, void functions (those that do not return a value to the calling function) are not required to include a return statement. Therefore, it is not necessary to include a return statement in your f...

See more

study24x7
Write a comment
Related Questions
500+   more Questions to answer
Most Related Articles