Anonymous

While Writing A C Program, How Many Types Of Errors Can Occur? Discuss Briefly. Which One Is The Most Difficult To Locate And Remove?

2

2 Answers

saima jabeen Profile
saima jabeen answered
There are the following errors can occur:
Syntax Error:
A collection of rules for writing programs in a programming language is known as syntax. Syntax error is a type of error that occurs when an invalid statement is written in program. Complier detects syntax errors. A program containing syntax error cannot be complied successfully.

There can be many causes of syntax errors. Some important causes are as follows:
The statement terminator is missing at the end of statement.
A variable is used without declaration.
Logical errors
A type of error that occurs due to poor logic of the programmer is known s logical error. A logical error occurs when the program follows a faulty algorithm. A statement with logical error may produce unexpected and wrong results in the program.
These errors are difficult to find because compiler does not detect these errors. It can only be detected by examining the program thoroughly.

Run Time Errors
A type error that occurs during the execution of program is known as run time error. It is caused when a statement directs the computer to execute an illegal operation such as dividing a number by zero.

These are commonly caused due to wrong input from the user.
raaga Profile
raaga answered
Different types of errors that can occur in C programs are discussed under the following headings:
1. syntax errors
2. logical errors
3. runtime errors

The syntax errors are those that occur by violation the syntax rules or language rules. These errors are detected by compiler so; the programmer can easily remove them. These are detected during the compilation process and program will not run until these errors are removed.

The logical errors are those that occur due to some programming flaw. It means code written by the programmer is syntactically correct but does not produce the required results because of wrong selection of algorithm to solve a problem.

These logical errors are not detected by compilers. The third type of errors is runtime errors . These errors occur due to some invalid value of any variable that is computed at runtime( division by 0 etc)

These are errors that can cause the termination of programs. These types of errors can be handled by careful analysis of algorithm chosen. The most severe type of errors are logical errors and secondly runtime errors. Because logical errors can't be detected by compiler but they exist. And runtime errors are those that when encountered, terminates the program without informing about any error. Thus, it becomes difficult for programmer to locate and remove such errors.

Answer Question

Anonymous