G

Gopal Sharma • 38.32K Points
Coach

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
  • Correct Answer - Option(A)
  • Views: 77
  • Filed under category C++

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

You must be Logged in to update hint/solution

Discusssion

Login to discuss.


Question analytics