divzero.c 236 B

123456789101112131415
  1. #include <signal.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. void handler(int signal) {
  5. printf("get signal: %d\n", signal);
  6. exit(0);
  7. }
  8. int main(void) {
  9. int i = 0;
  10. signal(SIGFPE, &handler);
  11. i = 1 / i;
  12. return 0;
  13. }