information about computer technology and about computer languages.

Thursday, 21 January 2021

Types of programming error in C

 Programming Errors is an illegal operation perform by user that is detected during the time of execution or compiling. Error are unidentified until the program is executed.  For the successful execution, the error must be removed from the program.

Types of programming errors

  • Syntax Error
  • Logical Error
  • Run Time Error
  • Linker Error
  • Semantic Error

Syntax Error

A collection of rules for writing programs is called syntax.  Syntax error occur  when you written invalid statement or when you violate the rules of writing C program syntax. These errors are also called compile time error cause this error occur during the time of compiling. The compiler detects error and display error message. The program cannot be executed successfully while having syntax error . Error must be fixed.
There can be many causes of syntax error.
  • The statement terminates is missing at the end of statement.
  • when semicolon or any of delimiters is missing.
  • when misspelled keyword is used.

Logical Error

A logical error occur due to the poor logic of programmer and it leads to desired output. it appears to be error free but produced incorrect output or result. Translator cannot detect logical errors. These types of error are mainly occur by beginners. Logical error depends on the logical thinking of the programmer. 
Compiler could not detect logical error so programmer has to check the entire code.

Run Time Error

Runtime error occurs while the program is executing after being successfully compiled. Runtime error are commonly called referred to as "bug". There are many runtime error occurs while compiling such as following:
  • Logical error
  • Input / Output error 
  • Undefined object error
  • division by 0 error

Linker Error 

Linker error occurs when the executable file is not created. This may be generated due to the wrong function prototyping, incorrect header files. Writing Main ( ) instead of main ( ) is the most common linker error. 

Semantic Error

Semantic error generated due to the wrong statement and it's not understandable by compiler or it's not meaningful to the compiler. 


No comments:

Post a Comment