LogiQuest
Back to Exception Handling
3

What will be the output of the program?

#include <iostream>
using namespace std;
#include <stdexcept>
int main() {
    try {
        throw out_of_range("bad index");
    } catch (const exception &e) {
        cout << e.what() << endl;
    }
    return 0;
}
Medium

Discussion (0)

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

Log in to join the discussion.