Answer Posted / chandan kiit
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 ? | 0 Yes | 4 No |
Post New Answer View All Answers
What’s the special use of UNIONS?
What is table lookup in c?
Create a simple code fragment that will swap the values of two variables num1 and num2.
How many levels of indirection in pointers can you have in a single declaration?
What language is lisp written in?
Give the rules for variable declaration?
How to write a code for reverse of string without using string functions?
What are the advantages of using new operator as compared to the function malloc ()?
What are header files in c?
Explain modulus operator. What are the restrictions of a modulus operator?
What is data structure in c programming?
write a program which the o/p should b in such a way that s triangle if I/p is 3,a Square/rectangle if I/P=4,a pentagon if I/P=5 and so on...forget about the I/P which is less than 3
What is the use of extern in c?
Why void is used in c?
Why pointers are used?