There are three types of errors that may occur while developing or writing C program. There errors are:
1.Syntax Errors
2.Logical Errors
3. Runtime Errors
2.Logical Errors
3. Runtime Errors
Syntax Errors:-
The set of rules (grammatical rules) of a programming language for writing statements of the computer program is known as syntax of the language. The program statements are written strictly according to these rules.
Syntax error occur when syntax of a programming language are not followed in writing the source code. The compiler detects these errors at compiling time of source code. The compiler reports a proper error message about the error.
The compiler does not compile a program that contain syntax errors. The syntax errors are easy to detect and remove.
In C program, there can be many causes of syntax errors. Some examples are given below:-
-> Missing semicolon ( ; ) at the end of statement.
->Missing any of delimiters i.e { or }
->Incorrect spelling of any keyword.
->Using variable without declaration etc.
->Missing any of delimiters i.e { or }
->Incorrect spelling of any keyword.
->Using variable without declaration etc.
Logical Errors:-
The errors in the logic of the program are called logical error. The compiler cannot detect logical errors. A program with logical errors is compiled (translated) and run successfully but it does not give correct result.
->The sequence of instructions used in a program may be incorrect.
->The mathematical formulas used in program instructions may be incorrect etc.
Runtime Errors:-
The errors that occur during the execution of program are called the runtime errors. These types of errors may occur due to the following reasons.
1)When the program attempts to perform an illegal operation such as dividing a number by zero..
2)If input data given to the program is not in a correct format or input data file is not found in the specified path...
3)If hardware problem occurs such as hard disk error, or disk full or printer error etc...
Note: When a runtime error occurs, the computer stops the execution of program and displays an error message.
No comments:
Post a Comment