Mega Code Archive

 
Categories / C++ / Language
 

Throwing Exceptions

#include <iostream> using namespace std; void foo() {    int  i;    i = -15;    throw i; } int main() {    try {       foo();    }    catch(int n)       { cerr << "exception caught\n " << n << endl; } }