πŸ“Š C++
Q. Which of the following is the correct way to define a function with a lambda expression in C++?
  • (A) auto myFunction = [](int x) { return x * x; };
  • (B) void myFunction(int x) { return x * x; }
  • (C) Both A and B
  • (D) None of the above
πŸ’¬ Discuss
βœ… Correct Answer: (A) auto myFunction = [](int x) { return x * x; };

Explanation: The correct way to define a function with a lambda expression is 'auto myFunction = [](int x) { return x * x; };'.

Explanation by: Gopal Sharma
The correct way to define a function with a lambda expression is 'auto myFunction = [](int x) { return x * x; };'.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
193
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Gopal Sharma
Publisher
πŸ“ˆ
84%
Success Rate