0% found this document useful (0 votes)
91 views

C Programming Error Types

The document discusses three types of errors that can occur when writing C programs: 1. Runtime errors occur during program execution and are caused by illegal operations like dividing by zero. 2. Compile errors happen during compilation and include syntax errors from violating C language rules and semantic errors where statements are not meaningful. 3. Logical errors involve flaws in program logic that produce incorrect outputs but are not caught by the compiler. Programmers must check code line-by-line to find logical errors.

Uploaded by

haldersubhas
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
91 views

C Programming Error Types

The document discusses three types of errors that can occur when writing C programs: 1. Runtime errors occur during program execution and are caused by illegal operations like dividing by zero. 2. Compile errors happen during compilation and include syntax errors from violating C language rules and semantic errors where statements are not meaningful. 3. Logical errors involve flaws in program logic that produce incorrect outputs but are not caught by the compiler. Programmers must check code line-by-line to find logical errors.

Uploaded by

haldersubhas
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

C Programming Error Types – Runtime,

Compile & Logical Errors


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.

Basically there are three types of errors in c programming:

1. Runtime Errors
2. Compile Errors
3. Logical Errors

C 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 performed in the
program.

Examples of some illegal operations that may produce runtime errors are:

 Dividing a number by zero


 Trying to open a file which is not created
 Lack of free memory space

It should be noted that occurrence of these errors may stop program


execution, thus to encounter this, a program should be written such that it is
able to handle such unexpected errors and rather than terminating
unexpectedly, it should be able to continue operating.

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:

Syntax Errors
When the rules of the c programming language are not followed, the compiler
will show syntax errors.

For example, consider the statement,

1 int a,b:

The above statement will produce syntax error as the statement is terminated
with : rather than ;

Semantic Errors

Semantic errors are reported by the compiler when the statements written in
the c program are not meaningful to the compiler.

For example, consider the statement,

1 b+c=a;

In the above statement we are trying to assign value of a in the value obtained
by summation of b and c which has no meaning in c. The correct statement
will be

1 a=b+c;

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 has to check the entire coding of a c program line by line.

You might also like