R

Rakesh Kumar • 28.44K Points
Instructor II

Q. Which of the following is the correct way to define a function with multiple default arguments in C++?

  • (A) void myFunction(int x = 10, int y = 20) { }
  • (B) void myFunction(int x, int y = 20) { }
  • (C) Both A and B
  • (D) None of the above
  • Correct Answer - Option(C)
  • Views: 35
  • Filed under category C++

Explanation by: Rakesh Kumar
Both options are valid ways to define a function with multiple default arguments in C++.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.


Question analytics