User Tools

Site Tools


c_-_c_exception_handling:c_exceptions

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
c_-_c_exception_handling:c_exceptions [2017/10/12 10:28] – created peterc_-_c_exception_handling:c_exceptions [2017/10/12 10:31] (current) – removed peter
Line 1: Line 1:
- 
-<code cpp> 
-#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; 
-} 
-</code> 
  
c_-_c_exception_handling/c_exceptions.1507804119.txt.gz · Last modified: 2020/07/15 09:30 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki