0% found this document useful (0 votes)
24 views2 pages

Types of Errors

Uploaded by

bishnu paudel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views2 pages

Types of Errors

Uploaded by

bishnu paudel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Types of program errors

program errors are also referred to as program bugs.


A C programing may have one or more of four types of
errors.
 Syntax error
 Runtime error
 Logic error

Syntax errors
Syntax errors represent grammar errors in the use of the
programming language. Common examples are
 Misspelled variable and functions names
 Missing semicolons
 Unmatched parentheses, square brackets, and curly
braces
 Incorrect format in selection and loop statements
Syntax errors are the easiest to find and fix. Over the years,
compiler developers have worked hard to make compilers
smarter so that they can catch errors at compile time that
might otherwise turn out to be run time errors.
Runtime errors
A type of error that occurs during the execution of a
program is known as runtime error. Runtime errors may
crash your program when you run it.
Common examples are:
 Try to divide by a variable that contains a value of 0
 Trying to open a file that does not exist
There is no way compiler to know about these kinds of
errors when the program is compiled. Runtime errors are
common due to wrong input from the user.

Logic errors
Logic errors occur when a programmer implements the
algorithm for solving a problem incorrectly. A statement
With logical error may produce unexpected and wrong
results in the program. Common examples are:
 Multiplying when you should be dividing
 Adding when you should be subtracting
 Opening and using data from the wrong file
 Displaying the wrong massage

Logic errors are the hardest to find and fix because:


 The compiler does not detect these errors
 These is no indication of error when the program is
executed

You might also like