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
Write a c program to demonstrate character and string constants?
Implement bit Array in C.
How can a program be made to print the line number where an error occurs?
What is identifiers in c with examples?
What is the difference between procedural and functional programming?
What is assignment operator?
What are valid operations on pointers?
What is the use of clrscr?
Explain how can I pad a string to a known length?
Differentiate Source Codes from Object Codes
How to check whether string is a palindrome, WITHOUT USING STRING FUNCTIONS?
What is the size of empty structure in c?
What is the use of the function in c?
a character or group of characters that defines a register,or a part of storage a) memory b) byte c) address d) linear list
Explain the binary height balanced tree?