Thursday, May 2, 2019

Types of Error in C


Error is a abnormal condition whenever it occurs execution of the program is stopped these are mainly classified into following types.

Types of Error in C

  • Compile Time Error
  • Run time error

Compile time error

If any error is generated at the time of compilation is known as compile time error, in general these are raised while break down the rules and regulation of programming language.

Compile Time Error Example

Missing semicolon, writing keyword in upper case, writing variable declaration, initialization after calling clrscr() function.
Compile time errors also known as syntax errors.
Compile time errorCompile time error

Run time error

If any error is generated at run time is known as runtime error, in general these are raised because of writing wrong logics in the program.

Example

Calling function without existence, divide by zero.
Int a=10,b;
B=a/0; --> infinite
Here out of range of int data type.
In general it is very difficult to identify logical error in C language, to overcome this problem exception handling was introduced in object oriented programming language.
error in c

Warning

Warning is also an abnormal condition but whenever it occurred execution of program will never be stopped.
Note: In C language warning can be neglected but error can not be neglected.
Warning in cWarning in c

No comments:

Post a Comment

Why learning C Programming is a must?

C is a procedural programming language. It was initially developed by Dennis Ritchie between 1969 and 1973. It was mainly developed as...