Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Types of errors 2019
1. Agenda
Warm up on line Quiz 1 15 min
Presentation about types of errors ppt 10 min
the sequence of program word file 5 min
Using computers and writing a program using code blocks and the lap tops 35
min
Exit ticket 5 min
http://www.stemassiut.info prepared by Mr.Osama Ghandour
3. Now set in groups
During the next PPT
Take note as
groups and I’ll
pick one
answer from
each group
One in desktop presents
One takes picture
One is observer
COS I will take his
comments in the
end of the session
4. Simple Data Types
4
Data types in C
Only really four basic types:
char
int (short, long, long long, unsigned)
float
double
Size of these types on
CLEAR machines:
Sizes of these types
vary from one machine
to another!
Type Size
(bytes)
Precision
char 1
int 2 to 4
short 2
long 4
float 4 6 decimal
places
double 8 15 decimal
places
Long double 10 19 decimal
places
5. Types of Errors
Quiz about data types 10 min
http://www.stemassiut.info prepared by Mr.Osama Ghandour
Warming Up
6. Types of Errors
There are three types of errors that may occur while developing or writing C
program. There errors are:
Syntax Errors
Logical Errors
Runtime Errors
http://www.stemassiut.info prepared by Mr.Osama Ghandour
7. Syntax Errors
The set of rules (grammatical rules) of a programming language for writing statements of the
computer program is known as syntax of the language. The program statements are written strictly
according to these rules.
Syntax error occur when syntax of a programming language are not followed in writing
the source code. The compiler detects these errors at compiling time of source code. The compiler
reports a proper error message about the error.
The compiler does not compile a program that contain syntax errors. The syntax errors
are easy to detect and remove.
In C program, there can be many causes of syntax errors. Some examples are given below:-
Missing semicolon ( ; ) at the end of statement.
Missing any of delimiters i.e { or }
Incorrect spelling of any keyword.
Using variable without declaration etc.
http://www.stemassiut.info prepared by Mr.Osama Ghandour
9. Logical Errors:-
The errors in the logic of the program are called logical error. The compiler cannot detect logical
errors. A program with logical errors is compiled (translated) and run successfully but it does not give
correct result.
The sequence of instructions used in a program may be incorrect.
The mathematical formulas used in program instructions may be incorrect etc.
The logical errors are difficult to detect. Logical errors can only be detected by examining all the
units of the program one by one. It is a very time consuming and lengthy process.
http://www.stemassiut.info prepared by Mr.Osama Ghandour
10. Runtime Errors
The errors that occur during the execution of program are called the runtime
errors. These types of errors may occur due to the following reasons.
When the program attempts to perform an illegal operation such as dividing a
number by zero.
If input data given to the program is not in a correct format or input data file
is not found in the specified path.
If hardware problem occurs such as hard disk error, or disk full or
printer error etc.
When a runtime error occurs, the computer stops the execution of program
and displays an error message.
http://www.stemassiut.info prepared by Mr.Osama Ghandour
12. You studied today about the
types of programming errors
write about how to use this L.O.
learning out come in your
capstone of recycling wasted
energy ?
Brain storm activity
13. Fred Kuhns
(3/25/2019)
CSE332– Object Oriented Programming Lab
A Simple C Program
Create example file: try.c
Compile using gcc:
gcc –o try try.c
The standard C library libc is included
automatically
Execute program
./try
Note, I always specify an absolute path
/* include stdio.h and stdlib.h */
#include <stdio.h>
#include <stdlib.h>
int main (void)
{
printf(“Hello Worldn”);
return 0;
}
14. Fred Kuhns
(3/25/2019)
CSE332– Object Oriented Programming Lab
Another Simple C Program
int main (int argc, char **argv) {
int i;
printf(“There are %d argumentsn”, argc);
for (i = 0; i < argc; i++)
printf(“Arg %d = %sn”, i, argv[i]);
return 0;
}
•Notice that the syntax is similar to Java
•What’s new in the above simple program?
–of course you will have to learn the new interfaces and utility
functions defined by the C standard and UNIX
17. Then name your project and save it a
folder in a drive .
18. A default simple code
you will find then write
your code and develop
your program from your
flowchart and defined
issue , build and run
program at first time
from build menu or F9
next time run it by
“CTRL+ F10” , save your
program /project Press here
for on line
Press here
for off line
OR
19. Home work1 write a program in C Language to
calculate Efficiency of a system / process build
and run the program and test the program to
avoid any error using Code Blocks .
20. Home work2 write a program in C Language to
calculate the measure of each interior angle of
a regular polygon of n-sides avoid any error
using Code Blocks .
Note the sum of measures of the interior angles
of a polygon of n-sides=(n-2)*180
Home work3 write a program in C Language to
draw a regular polygon of n-sides
21. 5 min Reflection
• Mansion the types of
programming errors write
about how to test the program
to avoid one of them?
Osama Ghandour Geris Assiut STEM
School 21