added SIGSEGV signal example

This commit is contained in:
Sebastian Brosch 2024-11-22 14:31:39 +01:00
parent 9219a29f62
commit 98f67bc7dc
Signed by: sebastianbrosch
GPG Key ID: 66E3143B54A6CF10

13
VL03-06-01/main.cc Normal file
View 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;
}