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
Can you please explain the difference between syntax vs logical error?
Disadvantages of C language.
How to define structures? ·
What is the total generic pointer type?
What are the types of pointers in c?
Hai what is the different types of versions and their differences
How can I direct output to the printer?
‘ C’ PROGRAME TO SHOW THE TYPE OF TRANGLE BY ACCEPTING IT’S LENGTH .
What do you mean by invalid pointer arithmetic?
write a sorting prgm to sort 50 nos and sum them and also remove all the occurrences of 15 and print it?
Describe wild pointers in c?
How is = symbol different from == symbol in c programming?
How can I handle floating-point exceptions gracefully?
What is a list in c?
Where register variables are stored in c?