Lecture 7 – Types of Errors in C
There
are three types of errors in C
Syntax errors
These
errors occur, if we misspell a keyword, type in wrong case, miss statement
delimiter etc.
Logical errors
This
error occurs, when we type wrong formula. For example we wanted to do A + B,
and by mistake we wrote A – B. The program will work just fine, but there would
be wrong output.
Runtime error
This
error is beyond the control of the programmer. For example, you try to send a
message to your friend and he/she’s offline.
|
Syntax Error
|
Logical Error
|
Runtime Error
|
|
Occurs when we misspell
a keyword
|
Occurs when we type
incorrect formula
|
Occurs when unknown
condition arises
|
|
Using wrong case. E.g.
writing Int instead of int
|
Using wrong formula.
E.g. writing C = A – B; instead of
C = A + B
|
Wrong input by the
user like
5 / 0 will give you a
math error
|
Table
6 – Syntax Logical and Runtime Error
Comments
Post a Comment