Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

HOW TO HANDLE EXCEPTIONS IN C

Answer Posted / chandan

There is no try,catch(available in C++,java..) facility to
handle exception in C.but we can handle exception by
validating data come from outside into the program.
eg.. cosider this code
void main(){
int a,b,div;
scanf("%d,%d",a,b)
div=a/b;
printf("%d",div);
}
int this case , b might be zero that will generate an
exception.so we can avoid it by using if statement.
if(b==0)
print("plz enter non zero value");

In this manner only we can prevent exception in C..

Thank you

Is This Answer Correct ?    6 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between test design and test case design?

2087


What are the 4 types of functions?

1050


What is dynamic memory allocation?

1335


What is the difference between mpi and openmp?

1284


How to throw some light on the b tree?

1081


Write a program to display all the prime nos from 1 to 1000000, your code should not take time more than a minute to display all the nos.

2069


State the difference between x3 and x[3].

1112


What is the maximum no. of arguments that can be given in a command line in C.?

1142


What does *p++ do? What does it point to?

1059


What is a good data structure to use for storing lines of text?

1082


What is scope rule of function in c?

1090


What does struct node * mean?

1013


Why is sprintf unsafe?

1069


Is c programming hard?

1015


show how link list can be used to repersent the following polynomial i) 5x+2

2294