What is an Error:

Errors in C language is defined as an illegal operation performed by the user which will result in the abnormal or abrupt working of the program logic.

Types of Errors in C:

1. Syntax Error

2. Run Time Error

3. Linker Error

4. Logical Error

5. Semantic Error

C programming does not provide direct support for error handling but is a system programming language. It is set as a global variable and indicates an error occurred during any function call. You can find various error codes defined in <error.h> header file.

The C programming language provides perror() and strerror() functions which can be used to display the text message associated with errno.

perror() :-  It displays the string you pass to it, followed by a colon, a space, and then the textual representation of the current errno value.
strerror() :- returns a pointer to the textual representation of the current errno value.
Errno:- error number.

Error Number and their values

errno value       Error message

1                    /* Operation not permitted */
2                    /* No such file or directory */
3                    /* No such process */
4                    /* Interrupted system call */
5                    /* I/O error */
6                    /* No such device or address */
7                    /* Argument list too long */
8                    /* Exec format error */
9                    /* Bad file number */
10                  /* No child processes */
11                  /* Try again */
12                  /* Out of memory */
13                  /* Permission denied */

Watch the Video Lecture


            Previous                                                                                                                       Next