Tyes of Errors
Tyes of Errors
Computer Science
Errors in C-Language
Presented by:
Rehan Khalid, Abdul
Rehman
Errors in C-Language
Examples
• Missing a delimiters somewhere in a program.
• Incorrect spelling of keyword shall generate Syntax
Error
• Missing a terminator at the end of a statement .
Program 1.1:-
#include<stdio.h>
#include<conio.h>
void main()
{ Terminator
is missing
int a;
clrscr()
a=10
printf(“Enter a value”);
scanf(“%d”,&a);
getch()
}
2) Logical Error:-
• An error that occurs due to poor logic of
programmer
• Produces unexpected result of program.
• Can’t be detected by compiler.
Examples.
Example.
• User ask program to open a file that does not
exist.
• User enter wrong data etc.
Program 1.3:-
#include<stdio.h>
#include<conio.h>
void main()
{
int a; illegal
statement
a=5;
a=a/0;
printf(“%d”,a);
getch()
}