Errors in programming
If you are a programmer, I expect you are familiar with the errors. It doesn’t matter whether you are coding in C++, Python, Java, or Swift. Errors are present everywhere as it is truly said that nothing is perfect in this world. There is a higher chance of error in programming if you are a beginner but it is negligible in the case of intermediate level or advanced level programmers. Programming is error-prone. The errors of programmers are called bugs.
Errors in Programming are basically classified into three types : –
- Syntax errors
- Semantic errors
- Runtime error
Let us discuss in brief to have a better understanding of errors (bugs) ->
1- Syntax errors
We use programming language just to interact with our machines in an efficient way. We give instructions to our machines in the form of codes. While instructing we follow some rules of the particular language. Syntax refers to the structure of a program and the rules about that structure. For example, In “C” language we use semi-colon to terminate the line like printf(“Tecblush”); but if you forget the semi-colon then it will be a syntax error. In English, readers can tolerate most syntax errors, but machines, compilers, and Interpreters are not so forgiving. If there is a single syntax error anywhere in your program, the compiler will display an error message and quit, and you will not be able to run your program.
2- Semantic errors
The second type of error is the semantic error. If there is a semantic error in your program, it will run successfully in the sense that the computer will not generate any error messages, but it will not do the right thing. It will do something else. Speciﬁcally, it will do what you told it to do. The problem is that the program you wrote is not the program you exactly wanted to write. Identifying semantic errors can be tricky because it requires you to work backward by looking at the output of the program and trying to ﬁgure out what it is doing. Semantic errors are generally for intermediate and advanced level programmer.
3- Runtime errors
The third type of error is a runtime error, so called because the error does not appear until after the program has started running. These errors are also called exceptions because they usually indicate that something exceptional (and bad) has happened. Runtime errors are rare in the simple programs.
Hope you enjoyed a lot. Keep exploring many more technical things on TECBLUSH and do let me know your views in the comment section.