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

  • (A) void myFunction(int x = 10) { }
  • (B) void myFunction(int x) { }
  • (C) Both A and B
  • (D) None of the above
πŸ’¬ Discuss
βœ… Correct Answer: (A) void myFunction(int x = 10) { }
Explanation: The correct way to define a function with a default argument is 'void myFunction(int x = 10) { }'.
Explanation by: Admin
The correct way to define a function with a default argument is 'void myFunction(int x = 10) { }'.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
142
Total Visits
πŸ“½οΈ
2 y ago
Published
πŸŽ–οΈ
Admin
Publisher
πŸ“ˆ
95%
Success Rate