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 oops c?
What are types of structure?
What does c mean?
code for quick sort?
Explain what are header files and explain what are its uses in c programming?
What is void pointers in c?
what is the difference between 123 and 0123 in c?
Explain what are the advantages and disadvantages of a heap?
What is the best way to comment out a section of code that contains comments?
about c language
Explain what math functions are available for integers? For floating point?
Is it possible to execute code even after the program exits the main() function?
What are the advantages of using linked list for tree construction?
Write a C/C++ program to add a user to MySQL. The user should be permitted to only "INSERT" into the given database.
What is the purpose of the preprocessor directive error?