EXCEPTION HANDLING - PowerPoint PPT Presentation

About This Presentation
Title:

EXCEPTION HANDLING

Description:

EXCEPTION HANDLING COURSE : MSc Computers and Network engineering. Name : Kirthidhar Gandham Module : Object Oriented Methods (16-7213) Module Leader : Prof. Alan goude – PowerPoint PPT presentation

Number of Views:204
Avg rating:3.0/5.0
Slides: 9
Provided by: Amer150
Category:

less

Transcript and Presenter's Notes

Title: EXCEPTION HANDLING


1
EXCEPTION HANDLING
  • COURSE MSc Computers and Network engineering.
  • Name Kirthidhar Gandham
  • Module Object Oriented Methods (16-7213)
  • Module Leader Prof. Alan goude
  • Deadline date 3/04/08
  • Student id 16031803

2
  • Before lets get talking about the concept of
    exception handling in c let us discuss some
    topics like what is an exception why we use
    exception handlers in c
  • What are different types of exceptions and what
    are the keywords that we use for exception
    handling mechanism

3
What is an Exception?
  • When we write a simple c program the first
    thing that we see when a program doesnt work
    correctly are bugs most common bugs are logical
    errors and syntactic errors but we can overcome
    these bugs by debugging but sometimes we come
    across some problems other than logical or syntax
    errors. These are known as Exceptions.

4
  • Exceptions are unusual conditions which occur at
    runtime like low disk space, division by zero,
    access to array outside its bounds to overcome
    these anomalies Exception handling concept plays
    a major role in c
  • Exceptions are of two types they are synchronous
    exceptions and asynchronous exceptions errors
    like out of range index or overflow come under
    synchronous exceptions and errors which are
    beyond the program like keyboard interrupts are
    called as asynchronous exceptions

5
  • Exception handling performs the following tasks
  • Finding the problem (Hit the exception).
  • Inform an error is occurred (Throw an exception).
  • Receive error information (Catch the exception).
  • Correct it (Handle the exception).

6
  • The keywords which are mainly used for exception
    handing mechanism are try, throw and catch.
  • Usually exceptions are thrown by functions which
    are invoked from try blocks and the point at
    which the throw is executed is called throw
    point. Once an exception is thrown to catch
    block, control cannot return to throw point.
  • General format code for this is
  • throw(object) //throws exception
  • ..
  • try
  • . //invoke function
  • catch(type arg)//catches exception
  • . //handles exception

7
  • These are the basic steps to write a c program
    using exception handling mechanism the program
    which shows the code is attached to this power
    point presentation separately in a word document.

8
  • References
  • Lecture notes given in class and examples given
    in module site.
  • Object oriented programming through c by
    B.chandra.
  • C how to program by paul dietel and harvey
    dietel.
  • C A beginners guide by herbert schildt.
  • The c standard library by nicolai M josuttis.
Write a Comment
User Comments (0)
About PowerShow.com