Complie time error – An error which is identified at compile time is called compile time error.
Below program will give compile time error:
int const *num = 100; /* Here num is a pointer to const integer */
++(*num); /* Illegal operation, the value of num cannot modify */
When we compile above program it gives below compile time error:
copile_time_error.c:5:2: error: increment of read-only location ‘*num’
Run time error – An error which is not caught by compiler but encountered with while executing the program. Below program will give run time error:
When we run this program the main function calls itself again and again. Each time the function is called its return address is stored in the call stack. Since there is no condition to terminate the function call, the call stack overflows at runtime. So it terminates the program and results in an error. This is “Runtime error: Stack overflow.”