372,652 views
35 votes
35 votes
Which of the following (i.e. there may be more than one correct answer, so select all) are reasons for defining a void function? The sole purpose of the function is to scan-in user input to an integer variable and return the result to the caller. The sole purpose of the function is to modify an array. The sole purpose of the function is to print formatted output to screen. The sole purpose of the function is to loop through an array, summing up all the elements, and returning the total sum to the caller. The sole purpose of the function is to perform a mathematical calculation and return the result to the caller.

User Akshay Kumar
by
2.6k points

1 Answer

17 votes
17 votes

Answer:

  • The sole purpose of the function is to modify an array. The sole purpose of the function is to print formatted output to screen.
  • The sole purpose of the function is to loop through an array, summing up all the elements, and returning the total sum to the caller.

Step-by-step explanation:

  • A void is a type of programming language and is derived for the C-type algorithm.
  • It is a result of a function that returns the task and doesn't provide a value or the end result to the caller. Such as in the return statement reaches the end function with the execution of a return statement but not with the value statement.
User Kunashir
by
3.5k points