What is the main cause of core dumps, and how do i fix them?
Usually bugs in accessing memory — for example, you have a character string: char str[10]; and in your code, you do: str[100] = ‘\0’; This might dump core because the assignment is writing memory that does not belong to ‘str’. You can use a debugger to locate the problem, but rather than learning to use a debugger at this stage, it might be easier to put printf statements in your code to locate at which statement your program is crashing. Then by printing values of the data being referenced by the statement you can figure out which variable is invalid.