In this article types of errors in c we give the information about Error is an unusual condition that stops execution of the program whenever it occurs.

Types of errors in C: 

Types of errors:-

Error is an unusual condition that stops execution of the program whenever it occurs.

Errors are mainly classified into the following types.

  1. Compiled time error
  2. Run time error

Compiled time error:-

If an error is found during compilation, it is known as compilation time error, usually raised when breaking programming language rules and regulations.

Example:

Missing semicolon, typing in keyword uppercase, typing variable declarations, initializing after calling the clrscr() function, missing curly brackets, missing comma operator, missing double inverted cotes etc.

Runtime error:-

If a runtime error occurs, it is known as a runtime error, usually due to incorrect logic in the program.

Example:

  1. Size of the array problem

You declare the max size of array is 10 and you entered the 15 elements so it a logical error i.e. runs time error.

  1. Divide by zero, since the calling function does not exist.

int a = 10, b;

b = a / 0; -> Infinity

Here int is out of range of data types.

It is very difficult for C language in general to identify a logical error; to overcome this problem Object Oriented Programming Language has started handling exceptions.

Warning:

Warning is also an unusual condition but whenever it happens the execution of the program will never be stopped.

Compile Time Error Example:

// Addition of two number

#include<stdio.h>

#include<conio.h>

void main()

{

int a=10, b=20, sum=0;

clrscr();

sum=a+b;

printf(“\n Sum of two numbers: %d”,sum)

getch();

}

O/P: Error

Missing semicolon.

Some More: 

POP- Introduction to Programming Using ‘C’

DS – Data structure Using C

OOP – Object Oriented Programming 

Java Programming

DBMS – Database Management System

RDBMS – Relational Database Management System

Join Now: Data Warehousing and Data Mining 

Leave a Reply

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