C Programming c programming notes for gate gate cse c programming questions gate questions on c programming gate study material for cse

Types of errors in c programming

What are different types of errors in c ?

Difference between syntax error and semantic error.

How logical errors are different from run time errors?.

Differentiate  compiler and interpreter.

In this technical article  different types of errors in c programming are 
explained. This article also covers the difference between syntax errors and
semantic errors, difference between logical errors and run time errors and 

difference between compiler and interpreter is also explained in this article.

difference between syntax and semantic errors
(A)     Difference between Syntactic and Semantic Error
 
Syntactic errors additionally called compilation errors and caused by violate the grammar rules of the programming language. The compiler detects, isolate these errors and provides terminate the computer program when listing the errors.
 
Some of the common syntactic errors are:
 
• missing or misplaced.
• missing return type for a procedure.
• missing or duplicate variable declaration.
 
Semantic errors are logical errors.
 
If there’s a run time error in an exceedingly program, it’ll run with success, in the sense that the computer will not generate any error messages, but it will no do the right thing.
 
The problem is that the means of the program is wrong. Here the term meaning of the program represents the semantics of the program.
 
Identifying linguistics  or semantic errors are often tough as a result of it needs working by observing the output of the program and attempting to work out what it’s doing.
(B)     Difference between Run time error and logical error
 
Run-time errors: Errors like data type mismatch or array out of bounds error are called run time errors.

These errors are typically go unobserved by the compiler thus programs with error can run however turn out incorrect results.
 
Logical errors: These are the errors which are connected with the logic of the program execution.
 
These errors aren’t detected by the compiler and these occurs due to  to a poor understanding of the program or an absence of clarity of hierarchy of operators.Such errors cause incorrect result.
( c) Difference between Compiler and Interpreter
 
These are the types of the language translators.
 
A compiler converts the computer program (user-written program or source code) into associate computer code (machine language by checking the whole program before execution)
 
If the program is error free, computer program is formed and loaded into memory for execution.
 
A compiler produces a mistake list of the program in one go and every one need to be taken care even before the execution of initial statement begin. It takes less time for execution.
 
An interpreter is additionally a language translator that interprets and executes statements within the program one by one.
 
It works on one statement at a time and if error free, executes the instruction before getting to second instruction.

Debugging is easier in interpreter because it is finished bit by bit.

An interpreter takes longer for execution of a program as compared to a compiler.

I hope that this article will be helpful for student to understand the concepts of different types of errors in c programming and the differences between syntax and semantic errors, logical errors and run time errors and compiler and interpreter.

Leave a Reply

Your email address will not be published. Required fields are marked *