Multiple choice general knowledge science & technology

At maximum, How many values can be returned by a C++ function?

  1. 0

  2. 1

  3. morethan 1

  4. depends on number of arguments

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

A C++ function can only return exactly one value. However, this single return value can be a compound type like struct, array, or tuple containing multiple values, or you can use output parameters/pointers to return multiple values indirectly. The function itself has exactly one return statement that returns one value.