#include using namespace std; struct E{}; int cnt = 3; void f(int i) { cout << "f(" << i << ")" << endl; if ( i == 0 ) throw E(); try { f(i-1); } catch( E ) { cout << "catch: cnt = " << cnt << " and i = " << i << endl; cnt -= 1; if (cnt > 0 ) f(2); } // catch } // f int main() { f(2); } // main