Advertisement Remove all ads

What is an Error ? Explain Different Types of Errors Occurred in Program. - Structured Programming Approach

What is an error ? Explain different types of errors occurred in program. 

Advertisement Remove all ads

Solution

Error :-
While writing c programs, errors also known as bugs in the world of programming may occur unwillingly which may prevent the program to compile and run correctly as per the expectation of the programmer.
Types of errors :-
Basically there are three types of errors in c programming:
1. Runtime Errors : 
        C runtime errors are those errors that occur during the execution of a c program and generally occur due to some illegal operation performedin the program. For example,
⇒ Dividing a number by zero
⇒ Trying to open a file which is not created
⇒ Lack of free memory space 

2. Compile Errors :-
Compile errors are those errors that occur at the time of compilation of the program. C compile errors may be further classified as:
2.1 Syntax Errors :
When the rules of the c programming language are not followed, the compiler will show syntax errors.
2.2 Semantic Errors :
Semantic errors are reported by the compiler when the statements written in the c program are not meaningful to the compiler.
3. Logical Errors :-
Logical errors are the errors in the output of the program. The presence of logical errors leads to undesired or incorrect output and are caused due to error in the logic applied in the program to produce the desired output. Also, logical errors could not be detected by the compiler, and thus, programmers have to check the entire coding of a c program line by line.

  Is there an error in this question or solution?
Advertisement Remove all ads
Advertisement Remove all ads
Advertisement Remove all ads
Share
Notifications

View all notifications


      Forgot password?
View in app×