What is Exception Handling?
Whenever we create any application/software in any language(Java,C,C++,Python etc) then there are chances of Runtime error which may occur even if the software is in production level,So such type issues are known as runtime error or Exception,So it become essential to manage such type of error otherwise it will disturb the normal flow of software/application.
I will give one example from that you will get clear idea about it,Lets suppose we have created one Calculator Application here we have integrated basics mathematics functions like Addition,Subtraction,Multiplication,Division.Here if user by mistakenly performing division operation of any number with 0 then it will raise an Exception and program execution will stop since it is not possible to divide any error with zero So to manage this type of issues we need to use Exception Handling concept.
Some of the most common Exception are as follow:
FileNotFoundException
DividebyZeroError
NullPointerExcption
MemoryError
Till the date,C Programming does not provide the exception handling or error handling directly but we can achieve it using one of the header file(errorno.h) provided by C.errorno.h header file contains all runtime error which may occur during the execution of c program and it has unique errorno associated with it.
In order to give the error message to user,A Developer has to prevent error at first place and return values from the function.Most of the C Function calls return -1 or NULL in case of an error
Following are Some of the common error and its description :
errno value Error
1 /* Operation not performed */
2 /* No such file or directory */
3 /* No such process */
4 /* Interrupted system call */
5 /* Input/Output error */
6 /* No such device or address */
7 /* Argument list too long */
8 /* Execution format error */
9 /* Bad file number */
10 /* No child processes */
11 /* Try again */
12 /* Out of memory */
13 /* Permission denied */
friends.
Gyansetu's Programming courses are a fantastic resource for aspiring coders. Their structured approach and dedicated instructors create an ideal learning environment. Whether you're starting from scratch or honing your skills, Gyansetu has the tools you need to succeed in the world of programming!
ReplyDeleteFor more info:- https://www.gyansetu.in/blogs/70-power-bi-mcq-and-answers-with-explanation/
Gyansetu's Programming courses are a fantastic resource for aspiring coders. Their structured approach and dedicated instructors create an ideal learning environment. Whether you're starting from scratch or honing your skills, Gyansetu has the tools you need to succeed in the world of programming!
ReplyDeleteFor more info:- https://www.gyansetu.in/blogs/70-power-bi-mcq-and-answers-with-explanation/