Errors and Exceptions

commandline session

$gcc error.c
$cat error.c
#include

main()
{
int a=0;
int b=10;
printf("Hello Alln");
printf("%d",b/a);
}

$./a.out > outputa
Floating point exception
$cat outputa
$
$./a.out 2> outputa
Hello All
Floating point exception
$./a.out > outputa
Floating point exception
$./a.out 2> outputb
Hello All
Floating point exception
$./a.out &> outputc
Floating point exception
$cat outputa
$
$cat outputb
$cat outputc
$

An Error “indicates serious problems that a reasonable application should not try to catch.

An Exception “indicates conditions that a reasonable application might want to catch.

source : http://stackoverflow.com/questions/5813614/what-is-difference-between-errors-and-exceptions

Leave a comment

Your email address will not be published. Required fields are marked *