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
Tell me what is null pointer in c?
What is the difference between pure virtual function and virtual function?
Explain #pragma statements.
What do you mean by invalid pointer arithmetic?
Why can’t we compare structures?
What is a macro, and explain how do you use it?
What is the purpose of void in c?
Describe how arrays can be passed to a user defined function
When should structures be passed by values or by references?
What are actual arguments?
How can I display a percentage-done indication that updates itself in place, or show one of those twirling baton progress indicators?
What happens if you free a pointer twice?
write a program to print the consecutive repeated character from the given string... input string is : hhhhjkutskkkkkggggj output should be like this: hhhhkkkkkgggg anyone help me...
How do you redirect a standard stream?
A collection of data with a given structure for excepting storing and providing on demand data for multiple users a) linked list b) datastructer c) database d) preprocessor