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 oops c?

1117


What are types of structure?

1068


What does c mean?

978


code for quick sort?

1989


Explain what are header files and explain what are its uses in c programming?

1113


What is void pointers in c?

960


what is the difference between 123 and 0123 in c?

1158


Explain what are the advantages and disadvantages of a heap?

1036


What is the best way to comment out a section of code that contains comments?

1267


about c language

1963


Explain what math functions are available for integers? For floating point?

1065


Is it possible to execute code even after the program exits the main() function?

1283


What are the advantages of using linked list for tree construction?

1026


Write a C/C++ program to add a user to MySQL. The user should be permitted to only "INSERT" into the given database.

1926


What is the purpose of the preprocessor directive error?

1204