/ Published in: C++
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
using namespace std; int main() { char *buf; try { buf = new char[512]; if( buf == 0 ) throw "Memory allocation failure!"; } catch( char * str ) { cout << "Exception raised: " << str << '\n'; } // ... return 0; }