This Blog is for New Computer Prgrammers

Monday 5 December 2016

Common Programming Errors

Common Programming Errors

The Programmer may come across errors while writing a computer program. In Programming languages these errors are called "bugs", and the mechanism to find and fix these errors is called "debugging", Some errors are caught by the compiler and some or not, There are common three types of errors normally occur while programming.

Syntax Error
These errors occur when we disobey the rules of writing in a language, means we violates the grammar rules of C Language, Compiler detects this kind of errors and stops the compilation process and shows a message box indicating what mistake has been done by the programmer.

Syntax are caught by the compiler.

Run time Errors.
This kind of errors occur due to environment of execution of the program or performing some illegal operation in the program such as dividing a number by Zero.

Run time errors are detected by the computer while executing the program and program is crashed if this kind of errors are not handled in the program logic.

Logical Errors.
This kind of errors are very hard to find, because every thing is good, Syntax is good, Environment is good, but the program is not behaving like we want, means not given the results we were expecting, to check this kind of errors we need to look into the program very carefully, check the values of variables on every step and then may be you would be able to find such errors, these errors are not detected by the compiler and not even by the environment, this is totally effort of the programmer to find and remove such type of errors.

Programming Languages
Computer programming languages are used to write computer programs, There are two major categories of programming languages i-e, Low Level Languages and High Level Languages.

Low Level Languages.

Low level languages are divided into two main categories i-e, Machine Language and Assembly Language. Machine language is the native language of the computer,  The computer does not need any translator to understand this language. Program written in any other language must be converted to machine language so that the computer can understand them. Machine language is consist on series of Binary digits 0's and 1's. As it is very difficult for human beings to remember long sequences of 0's and 1's, so writing programs in machine language could lead to full of errors, So it was thought to replace the long sequences of 0s and 1s with English like words, This idea gave the basis of the development of Assembly Language.

Assembly Language.
In Assembly Language, machine language instructions are replaced with English like words known as mnemonics. An Assembler is used to translate an assembly language programs into machine language.

High Level Language.
Programming languages whose instructions resemble the English language are called high level languages.  Every high level language defines a set of rules for writing programs called syntax of the language, Every instruction in the high level language must confirm  its syntax. If there is a syntax error in the program, it is reported by the language translator(Compiler or Interpreter),  

Common High level languages are C, C++, Java, Pascal, FORTRAN, BASIC, COBOL etc.

Share:

19 comments:

Total Pageviews