Difference between Compile Time Errors and Run Time Errors



Compile-time

  • During compile time the source code is converted into an executable code.
Run time 
  •  During the run time the executable code which is generated during the compile time, is started running. 
Both the compile-time and runtime refer to different types of error.


Compile-time errors

  • Occurs due to the wrong syntax or semantics of any programming language.
  • The compiler will not allow to run the program until all the errors are removed from the program. 
  • When all the errors are removed , only then the compiler will generate the executable file.
  • There are two types of compile time errors. Those are
    • Syntax errors
    • Semantic errors

1. Syntax Errors

  • When we does not follow the syntax of the used programming language, then the compiler will throw the syntax error. 


2. Semantic errors

 The semantic errors occurs when the coding statements are not meaningful to the compiler.



After correcting the semantic error,



Run time errors

  • Occur during the execution and after compilation.
  • These errors are not easy to detect and compiler does not find these errors.
Examples:
  1.     Division by zero
  2.     Determining the square root of a negative number

 






Comments

Post a Comment

Popular posts from this blog

Angular 6 - Data Binding Part 2

Machine Learning

Angular