SlideShare a Scribd company logo
3
Most read
4
Most read
10
Most read
PROGRAMMING ERRORS
WITH NEHA SHARMA
SYNTAX ERROR
SEMANTIC ERROR
LOGICAL ERROR
RUNTIME ERROR
Programming Error or bug
Unexpected output produced by program is called Error or bug
ERROR BUG
Found by
Developer
Found by
Tester
Debugging
Process of finding and removing errors in the program is called debugging
SYNTAX
ERROR
Invalid
statement
written in
code
SEMANTIC
ERROR
Meaningless
statements in
the code
LOGICAL
ERROR
Poor logics
in the code
RUNTIME
ERROR
Error in
execution of
successful
compilation
of code
TYPES OF ERROR
SYNTAX ERROR
-- It occurs due to the violation of syntax or grammatical rules
-- These errors are detected at compile time.
Missing semicolon and
datatype
Error in expression
//C++ program to illustrate syntax error
#include<iostream.h>
void main()
{
x = 10; // Error: Undeclared identifier x
int y = 15;
cout <<“value of x and y” <<x<<y
//Error : ';' expected
}
SYNTAX ERROR
-- It occurs due to the violation of one or more grammar rules.
-- These errors are detected at compile time.
C++ program to illustrate syntax error
#include<iostream.h>
void main()
{
int x = ( 3 + 5; // missing closing parenthesis ‘)’
int y = 3 + * 5; // missing argument between '+'
and ‘*’
}
Error in expression
Missing semicolon and
datatype
SEMANTIC ERROR
-- It occurs when the statements written in the program are not
meaningful to the compiler.
-- Difficult to detect because their syntax is correct but their
meaning is wrong.
//C++ program to illustrate semantic error
#include<iostream.h>
void main()
{
int a, b, c;
a + b = c;
//Error: lvalue required as left operand of
assignment
}
SEMANTIC ERROR
-- It occurs when the statements written in the program are not
meaningful to the compiler.
-- Difficult to detect because their syntax is correct but their
meaning is wrong.
//C++ program to illustrate semantic error
#include<iostream.h>
int main ()
{
int i;
i++; //Error: The variable ‘i’ is not
initialized
}
SEMANTIC ERROR
-- It occurs when the statements written in the program are not
meaningful to the compiler.
-- Difficult to detect because their syntax is correct but their
meaning is wrong.
C++ program to illustrate semantic error
#include<iostream.h>
void main()
{
int i= “Hello”
//Error: cannot convert 'char *' to 'int'
}
LOGICAL ERROR
-- It occurs because of wrong programming designing
-- Program with logical error are executed. But, does not generate the
requested result.
//C++ program to illustrate logical error
#include<iostream.h>
int main ()
{
for( ; ; )
{
cout<< "This loop will run forever” ;
}
return 0;
}
Infinite Loop
Errors in performed
computation
LOGICAL ERROR
-- It occurs because of wrong programming designing
-- Program with logical error are executed. But, does not generate the
requested result.
//C++ program to illustrate logical error
#include<iostream.h>
int main () // program: sum of two numbers
{
int a, b;
c= a-b;
cout<< “sum of two number is”<< c;
// This will always return wrong value wrt
specification required was sum of two numbers
}
Errors in performed
computation
Infinite Loop
RUNTIME ERROR
-- It occurs during program execution after successful compilation
--It occurs due to performing illegal operations.
-- It leads to abnormal termination of the program.
//C++ program to illustrate runtime error
#include<iostream.h>
void main()
{
int n = 9, div = 0;
div = n/0; // Error: number is divided by 0,
cout<<“The result is”<<div;
//This program abnormally terminates
}
RUNTIME ERROR
-- It occurs during program execution after successful compilation
--It occurs due to performing illegal operations.
-- It leads to abnormal termination of the program.
//C++ program to illustrate runtime error
#include<iostream.h>
void main()
{
char *ptr;
*ptr= 3; // Error: point illegal memory space
}
CONCLUSION
Ad

Recommended

Loops c++
Loops c++
Shivani Singh
 
Assembler
Assembler
manpreetgrewal
 
Conditional statement c++
Conditional statement c++
amber chaudary
 
Domain specific IoT
Domain specific IoT
Lippo Group Digital
 
Basics of c++ Programming Language
Basics of c++ Programming Language
Ahmad Idrees
 
Chapter-7 Relational Calculus
Chapter-7 Relational Calculus
Kunal Anand
 
Std 12 Computer Chapter 4 Introduction to Ecommerce (Part 1 Introduction and ...
Std 12 Computer Chapter 4 Introduction to Ecommerce (Part 1 Introduction and ...
Nuzhat Memon
 
C and C++ functions
C and C++ functions
kavitha muneeshwaran
 
Modular programming
Modular programming
Mohanlal Sukhadia University (MLSU)
 
Operator overloading
Operator overloading
Ramish Suleman
 
[OOP - Lec 07] Access Specifiers
[OOP - Lec 07] Access Specifiers
Muhammad Hammad Waseem
 
Unit 3. Input and Output
Unit 3. Input and Output
Ashim Lamichhane
 
Object oriented programming c++
Object oriented programming c++
Ankur Pandey
 
Function in C
Function in C
Dr. Abhineet Anand
 
C language unit-1
C language unit-1
Malikireddy Bramhananda Reddy
 
Input and Output In C Language
Input and Output In C Language
Adnan Khan
 
Relationship Among Token, Lexeme & Pattern
Relationship Among Token, Lexeme & Pattern
Bharat Rathore
 
Functions in c language
Functions in c language
tanmaymodi4
 
Basics of C programming
Basics of C programming
avikdhupar
 
Working with xml data
Working with xml data
aspnet123
 
Algorithm and flowchart
Algorithm and flowchart
Elizabeth de Leon Aler
 
Types of errors 2019
Types of errors 2019
Osama Ghandour Geris
 
Introduction to class in java
Introduction to class in java
kamal kotecha
 
Debugging
Debugging
Indu Sharma Bhardwaj
 
C tokens
C tokens
Manu1325
 
Pointer in C++
Pointer in C++
Mauryasuraj98
 
Code Optimization
Code Optimization
Akhil Kaushik
 
Basic programming concepts
Basic programming concepts
salmankhan570
 
Classes and Errors.pdf
Classes and Errors.pdf
rajaratna4
 
TYPES OF ERRORS.pptx
TYPES OF ERRORS.pptx
muskanaggarwal84101
 

More Related Content

What's hot (20)

Modular programming
Modular programming
Mohanlal Sukhadia University (MLSU)
 
Operator overloading
Operator overloading
Ramish Suleman
 
[OOP - Lec 07] Access Specifiers
[OOP - Lec 07] Access Specifiers
Muhammad Hammad Waseem
 
Unit 3. Input and Output
Unit 3. Input and Output
Ashim Lamichhane
 
Object oriented programming c++
Object oriented programming c++
Ankur Pandey
 
Function in C
Function in C
Dr. Abhineet Anand
 
C language unit-1
C language unit-1
Malikireddy Bramhananda Reddy
 
Input and Output In C Language
Input and Output In C Language
Adnan Khan
 
Relationship Among Token, Lexeme & Pattern
Relationship Among Token, Lexeme & Pattern
Bharat Rathore
 
Functions in c language
Functions in c language
tanmaymodi4
 
Basics of C programming
Basics of C programming
avikdhupar
 
Working with xml data
Working with xml data
aspnet123
 
Algorithm and flowchart
Algorithm and flowchart
Elizabeth de Leon Aler
 
Types of errors 2019
Types of errors 2019
Osama Ghandour Geris
 
Introduction to class in java
Introduction to class in java
kamal kotecha
 
Debugging
Debugging
Indu Sharma Bhardwaj
 
C tokens
C tokens
Manu1325
 
Pointer in C++
Pointer in C++
Mauryasuraj98
 
Code Optimization
Code Optimization
Akhil Kaushik
 
Basic programming concepts
Basic programming concepts
salmankhan570
 

Similar to Types of Programming Errors (20)

Classes and Errors.pdf
Classes and Errors.pdf
rajaratna4
 
TYPES OF ERRORS.pptx
TYPES OF ERRORS.pptx
muskanaggarwal84101
 
Programming in C - Types of Errorss.pptx
Programming in C - Types of Errorss.pptx
PoovizhiP1
 
C and its errors
C and its errors
Junaid Raja
 
Programming Error or Bug.pptx
Programming Error or Bug.pptx
Han Ni
 
Types of errors
Types of errors
Riya Josh
 
CPP10 - Debugging
CPP10 - Debugging
Michael Heron
 
C programming tokens & error types
C programming tokens & error types
argusacademy
 
Error correction-and-type-of-error-in-c
Error correction-and-type-of-error-in-c
Md Nazmul Hossain Mir
 
programming type error
programming type error
Walepak Ubi
 
SDD error types and detection
SDD error types and detection
Mike Cusack
 
(D 15 180770107240)
(D 15 180770107240)
RaviModi37
 
Hello world! Intro to C++
Hello world! Intro to C++
DSCIGDTUW
 
Programming Methodology
Programming Methodology
archikabhatia
 
(1.4) Identifying and Correcting Errors - PDF.pdf
(1.4) Identifying and Correcting Errors - PDF.pdf
DanzelUmapas1
 
Programming Methodology
Programming Methodology
Kulachi Hansraj Model School Ashok Vihar
 
Level of Program Correctness_Program_Reasoning.pptx
Level of Program Correctness_Program_Reasoning.pptx
chandankumar364348
 
Error detection recovery
Error detection recovery
Tech_MX
 
F6dc1 session6 c++
F6dc1 session6 c++
Mukund Trivedi
 
Understanding Syntax and Semanti (1).pptx
Understanding Syntax and Semanti (1).pptx
EricColubanAlipan
 
Classes and Errors.pdf
Classes and Errors.pdf
rajaratna4
 
Programming in C - Types of Errorss.pptx
Programming in C - Types of Errorss.pptx
PoovizhiP1
 
C and its errors
C and its errors
Junaid Raja
 
Programming Error or Bug.pptx
Programming Error or Bug.pptx
Han Ni
 
Types of errors
Types of errors
Riya Josh
 
C programming tokens & error types
C programming tokens & error types
argusacademy
 
Error correction-and-type-of-error-in-c
Error correction-and-type-of-error-in-c
Md Nazmul Hossain Mir
 
programming type error
programming type error
Walepak Ubi
 
SDD error types and detection
SDD error types and detection
Mike Cusack
 
(D 15 180770107240)
(D 15 180770107240)
RaviModi37
 
Hello world! Intro to C++
Hello world! Intro to C++
DSCIGDTUW
 
Programming Methodology
Programming Methodology
archikabhatia
 
(1.4) Identifying and Correcting Errors - PDF.pdf
(1.4) Identifying and Correcting Errors - PDF.pdf
DanzelUmapas1
 
Level of Program Correctness_Program_Reasoning.pptx
Level of Program Correctness_Program_Reasoning.pptx
chandankumar364348
 
Error detection recovery
Error detection recovery
Tech_MX
 
Understanding Syntax and Semanti (1).pptx
Understanding Syntax and Semanti (1).pptx
EricColubanAlipan
 
Ad

Recently uploaded (20)

WIRELESS COMMUNICATION SECURITY AND IT’S PROTECTION METHODS
WIRELESS COMMUNICATION SECURITY AND IT’S PROTECTION METHODS
samueljackson3773
 
machine learning is a advance technology
machine learning is a advance technology
ynancy893
 
How Binning Affects LED Performance & Consistency.pdf
How Binning Affects LED Performance & Consistency.pdf
Mina Anis
 
Decoding Kotlin - Your Guide to Solving the Mysterious in Kotlin - Devoxx PL ...
Decoding Kotlin - Your Guide to Solving the Mysterious in Kotlin - Devoxx PL ...
João Esperancinha
 
Learning – Types of Machine Learning – Supervised Learning – Unsupervised UNI...
Learning – Types of Machine Learning – Supervised Learning – Unsupervised UNI...
23Q95A6706
 
A Cluster-Based Trusted Secure Multipath Routing Protocol for Mobile Ad Hoc N...
A Cluster-Based Trusted Secure Multipath Routing Protocol for Mobile Ad Hoc N...
IJCNCJournal
 
NALCO Green Anode Plant,Compositions of CPC,Pitch
NALCO Green Anode Plant,Compositions of CPC,Pitch
arpitprachi123
 
Development of Portable Biomass Briquetting Machine (S, A & D)-1.pptx
Development of Portable Biomass Briquetting Machine (S, A & D)-1.pptx
aniket862935
 
Deep Learning for Natural Language Processing_FDP on 16 June 2025 MITS.pptx
Deep Learning for Natural Language Processing_FDP on 16 June 2025 MITS.pptx
resming1
 
VARICELLA VACCINATION: A POTENTIAL STRATEGY FOR PREVENTING MULTIPLE SCLEROSIS
VARICELLA VACCINATION: A POTENTIAL STRATEGY FOR PREVENTING MULTIPLE SCLEROSIS
ijab2
 
Introduction to Natural Language Processing - Stages in NLP Pipeline, Challen...
Introduction to Natural Language Processing - Stages in NLP Pipeline, Challen...
resming1
 
Complete guidance book of Asp.Net Web API
Complete guidance book of Asp.Net Web API
Shabista Imam
 
最新版美国圣莫尼卡学院毕业证(SMC毕业证书)原版定制
最新版美国圣莫尼卡学院毕业证(SMC毕业证书)原版定制
Taqyea
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-Glands & Lugs, Simplex...
362 Alec Data Center Solutions-Slysium Data Center-AUH-Glands & Lugs, Simplex...
djiceramil
 
David Boutry - Mentors Junior Developers
David Boutry - Mentors Junior Developers
David Boutry
 
grade 9 science q1 quiz.pptx science quiz
grade 9 science q1 quiz.pptx science quiz
norfapangolima
 
Structured Programming with C++ :: Kjell Backman
Structured Programming with C++ :: Kjell Backman
Shabista Imam
 
DESIGN OF REINFORCED CONCRETE ELEMENTS S
DESIGN OF REINFORCED CONCRETE ELEMENTS S
prabhusp8
 
Industry 4.o the fourth revolutionWeek-2.pptx
Industry 4.o the fourth revolutionWeek-2.pptx
KNaveenKumarECE
 
Montreal Dreamin' 25 - Introduction to the MuleSoft AI Chain (MAC) Project
Montreal Dreamin' 25 - Introduction to the MuleSoft AI Chain (MAC) Project
Alexandra N. Martinez
 
WIRELESS COMMUNICATION SECURITY AND IT’S PROTECTION METHODS
WIRELESS COMMUNICATION SECURITY AND IT’S PROTECTION METHODS
samueljackson3773
 
machine learning is a advance technology
machine learning is a advance technology
ynancy893
 
How Binning Affects LED Performance & Consistency.pdf
How Binning Affects LED Performance & Consistency.pdf
Mina Anis
 
Decoding Kotlin - Your Guide to Solving the Mysterious in Kotlin - Devoxx PL ...
Decoding Kotlin - Your Guide to Solving the Mysterious in Kotlin - Devoxx PL ...
João Esperancinha
 
Learning – Types of Machine Learning – Supervised Learning – Unsupervised UNI...
Learning – Types of Machine Learning – Supervised Learning – Unsupervised UNI...
23Q95A6706
 
A Cluster-Based Trusted Secure Multipath Routing Protocol for Mobile Ad Hoc N...
A Cluster-Based Trusted Secure Multipath Routing Protocol for Mobile Ad Hoc N...
IJCNCJournal
 
NALCO Green Anode Plant,Compositions of CPC,Pitch
NALCO Green Anode Plant,Compositions of CPC,Pitch
arpitprachi123
 
Development of Portable Biomass Briquetting Machine (S, A & D)-1.pptx
Development of Portable Biomass Briquetting Machine (S, A & D)-1.pptx
aniket862935
 
Deep Learning for Natural Language Processing_FDP on 16 June 2025 MITS.pptx
Deep Learning for Natural Language Processing_FDP on 16 June 2025 MITS.pptx
resming1
 
VARICELLA VACCINATION: A POTENTIAL STRATEGY FOR PREVENTING MULTIPLE SCLEROSIS
VARICELLA VACCINATION: A POTENTIAL STRATEGY FOR PREVENTING MULTIPLE SCLEROSIS
ijab2
 
Introduction to Natural Language Processing - Stages in NLP Pipeline, Challen...
Introduction to Natural Language Processing - Stages in NLP Pipeline, Challen...
resming1
 
Complete guidance book of Asp.Net Web API
Complete guidance book of Asp.Net Web API
Shabista Imam
 
最新版美国圣莫尼卡学院毕业证(SMC毕业证书)原版定制
最新版美国圣莫尼卡学院毕业证(SMC毕业证书)原版定制
Taqyea
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-Glands & Lugs, Simplex...
362 Alec Data Center Solutions-Slysium Data Center-AUH-Glands & Lugs, Simplex...
djiceramil
 
David Boutry - Mentors Junior Developers
David Boutry - Mentors Junior Developers
David Boutry
 
grade 9 science q1 quiz.pptx science quiz
grade 9 science q1 quiz.pptx science quiz
norfapangolima
 
Structured Programming with C++ :: Kjell Backman
Structured Programming with C++ :: Kjell Backman
Shabista Imam
 
DESIGN OF REINFORCED CONCRETE ELEMENTS S
DESIGN OF REINFORCED CONCRETE ELEMENTS S
prabhusp8
 
Industry 4.o the fourth revolutionWeek-2.pptx
Industry 4.o the fourth revolutionWeek-2.pptx
KNaveenKumarECE
 
Montreal Dreamin' 25 - Introduction to the MuleSoft AI Chain (MAC) Project
Montreal Dreamin' 25 - Introduction to the MuleSoft AI Chain (MAC) Project
Alexandra N. Martinez
 
Ad

Types of Programming Errors

  • 1. PROGRAMMING ERRORS WITH NEHA SHARMA SYNTAX ERROR SEMANTIC ERROR LOGICAL ERROR RUNTIME ERROR
  • 2. Programming Error or bug Unexpected output produced by program is called Error or bug ERROR BUG Found by Developer Found by Tester Debugging Process of finding and removing errors in the program is called debugging
  • 3. SYNTAX ERROR Invalid statement written in code SEMANTIC ERROR Meaningless statements in the code LOGICAL ERROR Poor logics in the code RUNTIME ERROR Error in execution of successful compilation of code TYPES OF ERROR
  • 4. SYNTAX ERROR -- It occurs due to the violation of syntax or grammatical rules -- These errors are detected at compile time. Missing semicolon and datatype Error in expression //C++ program to illustrate syntax error #include<iostream.h> void main() { x = 10; // Error: Undeclared identifier x int y = 15; cout <<“value of x and y” <<x<<y //Error : ';' expected }
  • 5. SYNTAX ERROR -- It occurs due to the violation of one or more grammar rules. -- These errors are detected at compile time. C++ program to illustrate syntax error #include<iostream.h> void main() { int x = ( 3 + 5; // missing closing parenthesis ‘)’ int y = 3 + * 5; // missing argument between '+' and ‘*’ } Error in expression Missing semicolon and datatype
  • 6. SEMANTIC ERROR -- It occurs when the statements written in the program are not meaningful to the compiler. -- Difficult to detect because their syntax is correct but their meaning is wrong. //C++ program to illustrate semantic error #include<iostream.h> void main() { int a, b, c; a + b = c; //Error: lvalue required as left operand of assignment }
  • 7. SEMANTIC ERROR -- It occurs when the statements written in the program are not meaningful to the compiler. -- Difficult to detect because their syntax is correct but their meaning is wrong. //C++ program to illustrate semantic error #include<iostream.h> int main () { int i; i++; //Error: The variable ‘i’ is not initialized }
  • 8. SEMANTIC ERROR -- It occurs when the statements written in the program are not meaningful to the compiler. -- Difficult to detect because their syntax is correct but their meaning is wrong. C++ program to illustrate semantic error #include<iostream.h> void main() { int i= “Hello” //Error: cannot convert 'char *' to 'int' }
  • 9. LOGICAL ERROR -- It occurs because of wrong programming designing -- Program with logical error are executed. But, does not generate the requested result. //C++ program to illustrate logical error #include<iostream.h> int main () { for( ; ; ) { cout<< "This loop will run forever” ; } return 0; } Infinite Loop Errors in performed computation
  • 10. LOGICAL ERROR -- It occurs because of wrong programming designing -- Program with logical error are executed. But, does not generate the requested result. //C++ program to illustrate logical error #include<iostream.h> int main () // program: sum of two numbers { int a, b; c= a-b; cout<< “sum of two number is”<< c; // This will always return wrong value wrt specification required was sum of two numbers } Errors in performed computation Infinite Loop
  • 11. RUNTIME ERROR -- It occurs during program execution after successful compilation --It occurs due to performing illegal operations. -- It leads to abnormal termination of the program. //C++ program to illustrate runtime error #include<iostream.h> void main() { int n = 9, div = 0; div = n/0; // Error: number is divided by 0, cout<<“The result is”<<div; //This program abnormally terminates }
  • 12. RUNTIME ERROR -- It occurs during program execution after successful compilation --It occurs due to performing illegal operations. -- It leads to abnormal termination of the program. //C++ program to illustrate runtime error #include<iostream.h> void main() { char *ptr; *ptr= 3; // Error: point illegal memory space }

Editor's Notes

  • #2: Hello Friends. in previous video we learned the concept of oops plus coding in c++, now we will discuss what all errors we face while running a program.
  • #3: Unexpected output produced by program is called Error or bug. Error is found by developer during coding where as bugs are found by the tester when the project is done. Some of the errors do not let program to be compiled and executed. For that debugging is required: debugging is a process of finding and removing errors in the program
  • #4: The most common errors can be broadly classified as follows. Let us now understand these errors with example using c++ and also how to fix them.
  • #5: First is syntax error: It occurs due to the violation of syntax or grammatical rules which is detected at compile time. Most frequent syntax errors are: --Missing datatype: datatype of x is missing which will generate an error: Undeclared identifier x --Missing semicolon: as you can see cout statement misses semicolon and in c++ it is mandatory to end the statement with ; so it will generate error.
  • #6: --second is: error in the expression: here in second statement: closing parenthesis for the expression is missing and in fourth statement: arguments between the operators.
  • #7: Now : Semantic error: It occurs when the statements written in the program are not meaningful to the compiler. It is difficult to detect because their syntax is correct but their meaning is wrong. These are detected either at compile time or runtime. Lets take example: -- Wrong statement: If some expression is given at the left side of assignment operator, this may generate semantic error.
  • #8: Next is Use of non-initialized variable: variable i has not been assigned any value before incrementing which will cause an error.
  • #9: Another is type incompatibility: Assigning a string value to integer type variable will produce an error as compiler can not convert string into integer. Fortunately, compiler generally catches both syntax and semantic errors and generate warnings or errors, so you easily identify and fix the problem
  • #10: Third type of error is Logical error. It occurs because of wrong programming design. Though program is executed as there is no syntax or semantic error but do not generate the desired results. --First is Infinite loop: When the conditional expression is absent, it is assumed to be true, leading to endless loop which is undesirable result. You can terminate an infinite loop by pressing Ctrl + C keys.
  • #11: Next is: errors in performed computation. Like here we want the addition as the output of two numbers but due to coding wrong expression i.e. subtraction, we got the wrong result. Manually the code should be checked to locate logical errors.
  • #12: Last is the Runtime error: It occurs during program execution after successful compilation due to illegal operations which leads to abnormal termination. The general cause of Run time errors is because your program is trying to perform an operation that is impossible to carry out. --Like: Division error: i.e. dividing a no. by 0 which will terminate the program abnormally.
  • #13: Next is pointing to null pointer: If you try to access or declare a null pointe: it will generate an error. Exception handling is used to avoid such runtime errors.
  • #14: Finally concluding, first we discussed what is programming error and bugs. Then we discussed types of error with examples with way of finding and removing error. That’s all friends, if you like the video please click the like button and for more such technical videos please subscribe the channel.