The abort() function is wich interrupt the execution of your program as if there
was a serious error. Use it to handle non-expected behavior like out-of bounds
exceptions :
#include <iostream>
int main(int argc, char **argv) {
int x;
cout << "Enter a non-null value : ";
cin >> x;
if(x == 0) {
cerr << "Null value!\n";
abort();
}
cout << 1/x << ’\n’;
}
The execution is the following :
Enter a non-null value : 0
Null value!
Aborted