Introduction to Programming - Errors


Errors are the mistakes or faults in the program that causes our program to behave unexpectedly and it is no doubt that the well versed and experienced programmers also makes mistakes. Programming error are generally known as Bugs and the process to remove bugs from program is called as Debug/Debugging.

There are basically three types of error:
  1. Compilation error:

    Compilation errors are the most common error occurred due to typing mistakes or if you don't follow the proper syntax of the specific programming language. These error are thrown by the compilers and will prevent your program from running. These errors are most common to beginners. It is also called as Compile time error or Syntax error. These errors are easy to debug.

    Example: Typing int as iNt

  2. Run Time error:

    Run Time errors are generated when the program is running and leads to the abnormal behavior or termination of the program. The general cause of Run time errors is because your program is trying to perform an operation that is impossible to carry out.

    Example: Dividing any number by zero, Accessing any file that doesn't exist etc are common examples of such error.

  3. Logical error:

    Logical error will cause your program to perform undesired operations which you didn't intended your program to perform. These errors occur generally due to improper logic used in program. These types of errors are difficult to debug.

    Example: Multiplying an uninitialized integer value with some other value will result in undesired output.
Happy coding ;)
Any doubt or suggestion write here. I will try my best to help. Before posting your code you must escape it to view. To format your source code and use format highlighting, post your source code inside
< pre>< code >----Your Source Code---- < / code > < / pre > (Remove spaces from pre and code tags)

No comments:

Post a Comment