LogiQuest
Back to Functions
11

What will be the output of the program?

#include <iostream>
using namespace std;
int main() {
    int total = 0;
    auto add = [&total](int v) { total += v; };
    add(5); add(7);
    cout << total << endl;
    return 0;
}
Easy

Discussion (0)

  • No discussion yet. Ask a doubt or share a shortcut.

Log in to join the discussion.