What are the types of errors are occurred in C ?

27 Dec 2022 Balmiki Mandal 0 C Programming

There are two types of Errors in c programming.

  • Compile-time error

  • Run time error

 

Compile Time Error: Compile-time Error is one type of error generated by the compiler

There are three types of Compile-time Error

  1. Pre-processor Error
  2. Translator Error
  3. Linker Error

 

1. Pre-processor Error: Pre-processor Error is responsible for a Header file

 

2. Translator Error: Translator Error Responsible for checking step by step compilation

► Note:   cc   -s    p1.c

►using this Command we are informing the compiler to stop Compilation after Translator

 

3. Linker Error: Linker Error: responsible for checking linkage with different object files with main object files.

  • This Error occurs when after compilations we link the different files with main object files.
  • These are generated when the executable files of the program can not be generated
  • this may be due to wrong function prototyping incorrect header file

 

Assembler Error: Assembler  Error get only when you or someone changes the code

► Note:        cc     -c    p1.c

► using this Command we are informing the compiler to stop Compilation after Assembler


Run Time Error:  cRun Time error is one type of error Generated by OS (operating system).

There are three types of  run time error

  1. Segmentation Fault Error
  2. floating-point exception error
  3. Bus error

 

1. Segmentation Fault Error: unauthorized memory access or unreserved memory access

 

2. floating-point exception error:   Floating point error occurs when any number dived with zero is happened (dived with Zero error)

n1=10;

n2=20/0;

n3=n1/n2; //floating point error

 

3. Bus Error:  if we are loading more than capacity in bus then bus error will get occurs.A bus error is a low-level hardware error


Note:-

Q1. Who generates the compile-time Error?

Ans:-Compiler

Q2. Who generates the run time  Error?

ANS:-OS (operating system)

 

BY: Balmiki Mandal

Related Blogs

Post Comments.

Login to Post a Comment

No comments yet, Be the first to comment.