added SIGSEGV signal example
This commit is contained in:
parent
9219a29f62
commit
98f67bc7dc
13
VL03-06-01/main.cc
Normal file
13
VL03-06-01/main.cc
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#include <csignal>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
void signal_handler(int signal) {
|
||||||
|
std::cout << "Es ist ein Segmentation Fault aufgetreten!";
|
||||||
|
}
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
std::signal(SIGSEGV, signal_handler);
|
||||||
|
int* a = nullptr;
|
||||||
|
*a = 5;
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user