User Tools

Site Tools


c_-_c_exception_handling:c_exceptions

This is an old revision of the document!


C - C++ Exception Handling - C++ Exceptions

#include <iostream>
using namespace std;
 
int main()
{
  cout << "Start\n";
 
  try {
    cout << "Inside try block\n";
    throw 1;                          // throw an error
    cout << "This will not execute";
  }
  catch (int i) {                     // catch an error
    cout << "Caught an exception -- value is: ";
    cout << i << "\n";
  }
  cout << "End";
  return 0;
}
c_-_c_exception_handling/c_exceptions.1507804147.txt.gz ยท Last modified: 2020/07/15 09:30 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki