From 98f67bc7dc80e54fd7118b8420197015763b28fe Mon Sep 17 00:00:00 2001 From: Sebastian Brosch Date: Fri, 22 Nov 2024 14:31:39 +0100 Subject: [PATCH] added SIGSEGV signal example --- VL03-06-01/main.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 VL03-06-01/main.cc diff --git a/VL03-06-01/main.cc b/VL03-06-01/main.cc new file mode 100644 index 0000000..c0a9312 --- /dev/null +++ b/VL03-06-01/main.cc @@ -0,0 +1,13 @@ +#include +#include + +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; +} \ No newline at end of file