Compile time & run time

Q1. Difference between Run time and compile time?
A: To become an executable program, source code should be compiled into machine code. This compilation process is known as compile time.

A compiled program can be opened and run by a user. When an application is running, it is called runtime

Compile-time: the time period in which you, the developer, are compiling your code.
Run-time: the time period which a user is running your piece of software.

Q2. Difference between Compile time & run time errors?
A: Compile time errors: Compilation or compile time errors are error occurred due to typing mistake, if we do not follow the proper syntax and semantics of any programming language then compile time errors are thrown by the compiler. They wont let your program to execute a single line until you remove all the syntax errors or until you debug the compile time errors.
Example: Missing a semicolon in C or mistyping int as Int.

Runtime errors: Runtime errors are the errors that are generated when the program is in running state. These types of errors will cause your program to behave unexpectedly or may even kill your program. They are often referred as Exceptions.
Example: Suppose you are reading a file that doesn’t exist, will result in a runtime error.

Leave a Reply

Your email address will not be published. Required fields are marked *