A core dump is a file in a computer’s documented memory when a program or computer crashes. It consists of a recorded state of the working memory of the computer program at a particular point in time, usually when the program crashes.
Note: Core dump is an integral part of diagnosing the cause of the program crash. The data the application was retrieving is in the core dump, along with information about which part of the application was running at the time of the crash.
A process dumps core when the operating system terminates it due to an error in the program. The most usual reason for this is that the program accessed an invalid pointer value.
The core dump file may contain the following information:
int main(){char *val;val = "Educative";*(val+5) = 'h';return 0;}
The above code throws an error of core dump. In line 5, the program attempts to write h
to a memory location, which is not allocated for this program. Hence, the code results in a segmentation fault.
Free Resources