Write the code (you don't have to write a full function...just the relevant lines of code) to invoke this function when a segmentation fault occurs.
Assume that your
void bailout (int num) { write (STDERR_FILENO, "Oops\n", 5); exit (0); }
Write the code (you don't have to write a full function...just the relevant lines of code) to invoke this function when a segmentation fault occurs.
Segmentation faults which are absolutely reported to our program and that don't need to result in program termination on at least with the Windows and all POSIX platforms and also in the termination is just the default behavior. Segmentation Fault just means that the OS killed your process for trying to reach outside its memory segment. There's no opportunity for your process to print out the cleanup info, though you might be able to get a "core dump" out of it.
Step by step
Solved in 3 steps