In this article types of errors in c we give the information about Error is an unusual condition that stops execution of the program whenever it occurs.
Types of errors in C:
Types of errors:-
Error is an unusual condition that stops execution of the program whenever it occurs.
Errors are mainly classified into the following types.
- Compiled time error
- Run time error
Compiled time error:-
If an error is found during compilation, it is known as compilation time error, usually raised when breaking programming language rules and regulations.
Missing semicolon, typing in keyword uppercase, typing variable declarations, initializing after calling the clrscr() function, missing curly brackets, missing comma operator, missing double inverted cotes etc.
If a runtime error occurs, it is known as a runtime error, usually due to incorrect logic in the program.
- Size of the array problem
You declare the max size of array is 10 and you entered the 15 elements so it a logical error i.e. runs time error.
- Divide by zero, since the calling function does not exist.
int a = 10, b;
b = a / 0; -> Infinity
Here int is out of range of data types.
It is very difficult for C language in general to identify a logical error; to overcome this problem Object Oriented Programming Language has started handling exceptions.
Warning is also an unusual condition but whenever it happens the execution of the program will never be stopped.
Compile Time Error Example:
// Addition of two number
int a=10, b=20, sum=0;
printf(“\n Sum of two numbers: %d”,sum)