1

I'm trying to run a simple program of stack unwinding but it seems to be like my dev c++ is not supporting exception handling(i.e., try,catch,throw). Is there an error in my code or my dev c++?

#include<iostream>
#include<exception>

using namespace std;

void funcA();
void funcB();
void funcC() throw(myException);


void funcA() throw(myException){

funcB();
} 

void funcB() throw(myException){

try{
    funcC();    
}
catch(myException me){
    cout<<me.what()<<" \n But Caught in function B"<<endl;
}
}

void funcC throw(myException){

throw myException("Exception generated in Function C.");
}


int main(){

try{

    funcA();

}catch(myException e){

    cout<<e.what()<<"Caught in Main."<<endl;

}
return 0;

}
Tavish Barua
  • 41
  • 1
  • 4

0 Answers0