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
What is the difference between test design and test case design?
What are the 4 types of functions?
What is dynamic memory allocation?
What is the difference between mpi and openmp?
How to throw some light on the b tree?
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.
State the difference between x3 and x[3].
What is the maximum no. of arguments that can be given in a command line in C.?
What does *p++ do? What does it point to?
What is a good data structure to use for storing lines of text?
What is scope rule of function in c?
What does struct node * mean?
Why is sprintf unsafe?
Is c programming hard?
show how link list can be used to repersent the following polynomial i) 5x+2