feat: update structure

This commit is contained in:
2024-01-22 14:27:40 +08:00
parent 7836c9185c
commit 3544a28a2e
559 changed files with 120846 additions and 4102 deletions

21
cs2106/lectures/l5/4.c Normal file
View File

@@ -0,0 +1,21 @@
#include <stdio.h>
#include <signal.h>
#include <unistd.h>
#include <stdlib.h>
void myOwnHandler(int signo) {
if (signo == SIGSEGV) {
printf("Memory Access blows up!\n");
exit(1);
}
}
int main() {
int *ip = NULL;
if (signal(SIGSEGV, myOwnHandler) == SIG_ERR)
printf("Failed to register handler\n");
*ip = 123;
return 0;
}