207k views
1 vote
Rather than passing the only parameter by address to a void function, it is better to make use of the return statement in the function to send the needed value to the calling function.

a) True
b) False

1 Answer

0 votes

Final answer:

It is false that using a return statement is always better than passing a parameter by address; the best approach depends on the function's purpose.

Step-by-step explanation:

The question is asking whether it is better to return a value from a function than to pass a parameter by address to a void function. This decision can be context-dependent. It is false to assert that one way is inherently better than the other without considering the situation. If the function in question is expected to return a single value and does not need to modify the original argument, using a return statement is appropriate and conventional. However, if the function intends to modify the original argument, or if it needs to return multiple values, then passing by address is the necessary approach.

User Nathan Taylor
by
7.9k points