Home » Software » 3 Common Programming Errors

3 Common Programming Errors

When you starting to learn making program, you will realize that a program rarely runs correctly the first time it compiled. Murphy’s Law, “Anything that can go wrong — will go wrong.” seems right in this case. In fact, errors are so common in programming world that they have their own name “bugs” and the process to fix them is debugging a program. I will show you 3 Common Programming Errors in this article.

Compile-Program-meme 3 Common Programming Errors

When a compiler detects an error, it will displays an error messages. Which indicates that your program is gone wrong. Unfortunately, Most beginner programmer having trouble to interpret it and sometimes misleading. As you gain experience, you will become more proficient at identifying and correcting program errors.

There are 3 kinds of common errors in Programming, they are

  1. Syntax Errors
  2. Run-Time Errors
  3. Logic Errors

Syntax Errors, The Most Common Programming Errors

Syntax error are most common error among beginners. This kind of error occurs when your code violates one or more grammar rules of programming language and the compiler failed to translate your program. If a statement has a syntax error, it cannot be translated and it will not be executed. Let’s take a look at C Language Program example below.

That example shows a listing of a Kilometers to Meters program. The program contains the following syntax errors:

  • Missing semicolon at the end of variable declaration (Red line)
  • Using an undeclared variable kilometers (Blue Lines)
  • Mistyped function printf (Orange Line)

Run-Time Errors

Unlike Syntax Errors, Run-Time Errors is detected after or during the execution of a program. A run-time error occurs when the program performing an illegal operation (Such as dividing a number by zero, and etc). When a run-time error occurs, the computer will display a diagnostic message that indicates  the line where the error was detected.

Many execution errors may not detected (displaying a diagnostic message), but they may simply lead you to incorrect output result. In order to identifying it, it’s essential that you testing it by predict the result of your program should produce and verify that the actual output is correct.

Logic Errors

Compile-meme-286x300 3 Common Programming ErrorsLogic Errors, another common programming errors, happen when program executing a faulty algorithm. Because this error usually do not display an error messages and do not cause run-time errors. They are very difficult to detect. So it’s very important to prevent logic errors by carefully manual checking the algorithm and the entire program before you type it in. Because debugging/fixing this kind of error can be time-consuming. Plan your program’s source code carefully and manually check them to eliminate the bugs early. By preventing Logic Errors, it will save time and avoid trouble.


Leave a Reply

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

Name *
Email *