Tuesday, 23 December 2014

errors and types of errors

TYPES OF ERRORS:

Syntax Errors

When the rules of the c programming language are not followed, the compiler will show syntax errors.
For example, consider the statement,
1
int a,b:
The above statement will produce syntax error as the statement is terminated with : rather than ;

Semantic Errors

Semantic errors are reported by the compiler when the statements written in the c program are not meaningful to the compiler.
For example, consider the statement,
1
b+c=a;
In the above statement we are trying to assign value of a in the value obtained by summation of b and c which has no meaning in c. The correct statement will be
1
a=b+c;

Logical Errors

Logical errors are the errors in the output of the program. The presence of logical errors leads to undesired or incorrect output and are caused due to error in the logic applied in the program to produce the desired output.
Also, logical errors could not be detected by the compiler, and thus, programmers has to check the entire coding of a c program line by line

No comments:

Post a Comment