SlideShare a Scribd company logo
3
Most read
4
Most read
9
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

More Related Content

PPSX
Complete C++ programming Language Course
Vivek Singh Chandel
 
PPTX
C and its errors
Junaid Raja
 
PPT
Modular programming
Mohanlal Sukhadia University (MLSU)
 
PPTX
C Programming Language Tutorial for beginners - JavaTpoint
JavaTpoint.Com
 
PPTX
C language
Rohit Singh
 
PPTX
Ide description
Nidhi Baranwal
 
PDF
C Language
Syed Zaid Irshad
 
PPT
Assembler
manpreetgrewal
 
Complete C++ programming Language Course
Vivek Singh Chandel
 
C and its errors
Junaid Raja
 
C Programming Language Tutorial for beginners - JavaTpoint
JavaTpoint.Com
 
C language
Rohit Singh
 
Ide description
Nidhi Baranwal
 
C Language
Syed Zaid Irshad
 
Assembler
manpreetgrewal
 

What's hot (20)

PPTX
Python Exception Handling
Megha V
 
PPTX
Algorithm and pseudo codes
hermiraguilar
 
PDF
Python exception handling
Mohammed Sikander
 
PPTX
Constant, variables, data types
Pratik Devmurari
 
PPTX
CONTROL STRUCTURE IN VB
classall
 
PPTX
C Programming: Control Structure
Sokngim Sa
 
PPTX
Data Types and Variables In C Programming
Kamal Acharya
 
PPTX
Conditional statements
University of Potsdam
 
PPTX
OOPS In JAVA.pptx
Sachin33417
 
PPTX
Programming Fundamentals
Trivuz ত্রিভুজ
 
PPTX
Algorithm and flowchart
Rabin BK
 
PPTX
Functions in C
Kamal Acharya
 
PPTX
Introduction to Basics of Python
Elewayte
 
PPTX
Python Functions
Mohammed Sikander
 
PPTX
I/O Streams
Ravi Chythanya
 
PPTX
Assembly Language
Ibrahimcommunication Al Ani
 
PPTX
Preprocessor directives in c language
tanmaymodi4
 
PPTX
Programming language
RajThakuri
 
PPTX
Abstract Data Types
karthikeyanC40
 
PPT
Basics of c++ Programming Language
Ahmad Idrees
 
Python Exception Handling
Megha V
 
Algorithm and pseudo codes
hermiraguilar
 
Python exception handling
Mohammed Sikander
 
Constant, variables, data types
Pratik Devmurari
 
CONTROL STRUCTURE IN VB
classall
 
C Programming: Control Structure
Sokngim Sa
 
Data Types and Variables In C Programming
Kamal Acharya
 
Conditional statements
University of Potsdam
 
OOPS In JAVA.pptx
Sachin33417
 
Programming Fundamentals
Trivuz ত্রিভুজ
 
Algorithm and flowchart
Rabin BK
 
Functions in C
Kamal Acharya
 
Introduction to Basics of Python
Elewayte
 
Python Functions
Mohammed Sikander
 
I/O Streams
Ravi Chythanya
 
Assembly Language
Ibrahimcommunication Al Ani
 
Preprocessor directives in c language
tanmaymodi4
 
Programming language
RajThakuri
 
Abstract Data Types
karthikeyanC40
 
Basics of c++ Programming Language
Ahmad Idrees
 
Ad

Similar to Types of Programming Errors (20)

PDF
Classes and Errors.pdf
rajaratna4
 
PPTX
TYPES OF ERRORS.pptx
muskanaggarwal84101
 
PPTX
Programming in C - Types of Errorss.pptx
PoovizhiP1
 
PPTX
Programming Error or Bug.pptx
Han Ni
 
PPTX
Types of errors
Riya Josh
 
PPT
CPP10 - Debugging
Michael Heron
 
PPSX
C programming tokens & error types
argusacademy
 
PPTX
Error correction-and-type-of-error-in-c
Md Nazmul Hossain Mir
 
PPTX
programming type error
Walepak Ubi
 
PPTX
SDD error types and detection
Mike Cusack
 
PPTX
Types of errors 2019
Osama Ghandour Geris
 
DOCX
(D 15 180770107240)
RaviModi37
 
PPTX
Hello world! Intro to C++
DSCIGDTUW
 
PPT
Programming Methodology
archikabhatia
 
PPT
programming lang for advance level new edition.ppt
jafargubwi
 
PDF
(1.4) Identifying and Correcting Errors - PDF.pdf
DanzelUmapas1
 
PPT
Programming Methodology
Kulachi Hansraj Model School Ashok Vihar
 
PPTX
Level of Program Correctness_Program_Reasoning.pptx
chandankumar364348
 
PPTX
Error detection recovery
Tech_MX
 
PPT
F6dc1 session6 c++
Mukund Trivedi
 
Classes and Errors.pdf
rajaratna4
 
TYPES OF ERRORS.pptx
muskanaggarwal84101
 
Programming in C - Types of Errorss.pptx
PoovizhiP1
 
Programming Error or Bug.pptx
Han Ni
 
Types of errors
Riya Josh
 
CPP10 - Debugging
Michael Heron
 
C programming tokens & error types
argusacademy
 
Error correction-and-type-of-error-in-c
Md Nazmul Hossain Mir
 
programming type error
Walepak Ubi
 
SDD error types and detection
Mike Cusack
 
Types of errors 2019
Osama Ghandour Geris
 
(D 15 180770107240)
RaviModi37
 
Hello world! Intro to C++
DSCIGDTUW
 
Programming Methodology
archikabhatia
 
programming lang for advance level new edition.ppt
jafargubwi
 
(1.4) Identifying and Correcting Errors - PDF.pdf
DanzelUmapas1
 
Level of Program Correctness_Program_Reasoning.pptx
chandankumar364348
 
Error detection recovery
Tech_MX
 
F6dc1 session6 c++
Mukund Trivedi
 
Ad

Recently uploaded (20)

PDF
Introduction to Data Science: data science process
ShivarkarSandip
 
PPTX
unit 3a.pptx material management. Chapter of operational management
atisht0104
 
PPTX
22PCOAM21 Session 1 Data Management.pptx
Guru Nanak Technical Institutions
 
PDF
Traditional Exams vs Continuous Assessment in Boarding Schools.pdf
The Asian School
 
PPTX
MT Chapter 1.pptx- Magnetic particle testing
ABCAnyBodyCanRelax
 
PPTX
22PCOAM21 Data Quality Session 3 Data Quality.pptx
Guru Nanak Technical Institutions
 
PDF
67243-Cooling and Heating & Calculation.pdf
DHAKA POLYTECHNIC
 
PPTX
Victory Precisions_Supplier Profile.pptx
victoryprecisions199
 
PPT
SCOPE_~1- technology of green house and poyhouse
bala464780
 
PPTX
business incubation centre aaaaaaaaaaaaaa
hodeeesite4
 
PDF
Queuing formulas to evaluate throughputs and servers
gptshubham
 
PDF
settlement FOR FOUNDATION ENGINEERS.pdf
Endalkazene
 
PPTX
AgentX UiPath Community Webinar series - Delhi
RohitRadhakrishnan8
 
PDF
Chad Ayach - A Versatile Aerospace Professional
Chad Ayach
 
PDF
dse_final_merit_2025_26 gtgfffffcjjjuuyy
rushabhjain127
 
DOCX
SAR - EEEfdfdsdasdsdasdasdasdasdasdasdasda.docx
Kanimozhi676285
 
PDF
top-5-use-cases-for-splunk-security-analytics.pdf
yaghutialireza
 
PPT
Ppt for engineering students application on field effect
lakshmi.ec
 
PDF
Cryptography and Information :Security Fundamentals
Dr. Madhuri Jawale
 
PPTX
Inventory management chapter in automation and robotics.
atisht0104
 
Introduction to Data Science: data science process
ShivarkarSandip
 
unit 3a.pptx material management. Chapter of operational management
atisht0104
 
22PCOAM21 Session 1 Data Management.pptx
Guru Nanak Technical Institutions
 
Traditional Exams vs Continuous Assessment in Boarding Schools.pdf
The Asian School
 
MT Chapter 1.pptx- Magnetic particle testing
ABCAnyBodyCanRelax
 
22PCOAM21 Data Quality Session 3 Data Quality.pptx
Guru Nanak Technical Institutions
 
67243-Cooling and Heating & Calculation.pdf
DHAKA POLYTECHNIC
 
Victory Precisions_Supplier Profile.pptx
victoryprecisions199
 
SCOPE_~1- technology of green house and poyhouse
bala464780
 
business incubation centre aaaaaaaaaaaaaa
hodeeesite4
 
Queuing formulas to evaluate throughputs and servers
gptshubham
 
settlement FOR FOUNDATION ENGINEERS.pdf
Endalkazene
 
AgentX UiPath Community Webinar series - Delhi
RohitRadhakrishnan8
 
Chad Ayach - A Versatile Aerospace Professional
Chad Ayach
 
dse_final_merit_2025_26 gtgfffffcjjjuuyy
rushabhjain127
 
SAR - EEEfdfdsdasdsdasdasdasdasdasdasdasda.docx
Kanimozhi676285
 
top-5-use-cases-for-splunk-security-analytics.pdf
yaghutialireza
 
Ppt for engineering students application on field effect
lakshmi.ec
 
Cryptography and Information :Security Fundamentals
Dr. Madhuri Jawale
 
Inventory management chapter in automation and robotics.
atisht0104
 

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.