LogiQuest
Back to Exception Handling
11

What will be the output of the program?

#include <iostream>
using namespace std;
void f() { throw 5; }
void g() { f(); cout << "g"; }
int main() {
    try { g(); } catch (int v) { cout << v; }
    cout << endl;
    return 0;
}
Medium

Discussion (0)

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

Log in to join the discussion.