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 are the usage of pointer in c?
Can you think of a logic behind the game minesweeper.
What is bubble sort technique in c?
what is the difference between north western polytechnique university and your applied colleges?? please give ur answers for this. :)
What is d'n in c?
What is the difference between typedef struct and struct?
What are the different types of objects used in c?
Explain the properties of union. What is the size of a union variable
What is the best style for code layout in c?
Explain how to reverse singly link list.
Difference between pass by reference and pass by value?
Differentiate between new and malloc(), delete and free() ?
What is a structure and why it is used?
What is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be used?
How do I determine whether a character is numeric, alphabetic, and so on?