Forum

Number Of Page View:100,000+/Months
LOGIN |New User

Reply

How can we handle exceptions in C? 
In C we handle exceptions without using try,catch block.Which i used in java,C++ etc.But we can handle exception using validation of data from out side of the world.
Example:
void main()
{
   int m,n,divide;
   scanf("%d,%d",m,n);
   divide=m/n;
   printf("%d",divide);
}
In this n may be zero,that generate exception.So,we can avoid them using if statement.
if(n==0)
        print("you have to enter non-zero value");
Using this we only prevent from exception not handle it.

Posted By: Name:Rajesh Kr URL: How can we handle exceptions in C?