Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

C Standard Library – <errno.h>


May 11, 2021 C


Table of contents


C Standard Library - slt;errno.h.gt;

Brief introduction

The C standard library's errno.h header file defines the integer variable errno, which is set by a system call, and some library functions in the error event indicate what has gone wrong. The macro extends to a changeable left value of type int, so it can be read and modified by a program.

When the program starts, errno is set to zero, and a specific function in the C standard library modifies its value to some non-zero value to represent some type of error. You can also modify its value or reset it to zero when appropriate.

The errno.h header file also tops a series of macros that represent different error codes that should be extended to integer constant expressions of type int.

Library macros

The macros defined in the header file errno.h are listed below:

Serial number Macro & Description
1 extern int errno
This is the macro set by the system call, and some library functions in the error event indicate what happens.
2 EDOM Domain Error
This macro represents an domain error that occurs when the input parameter is exceeded by the domain defined by the math function, and errno is set to EDOM.
3 ERANGE Range Error
This macro represents a range error that occurs when the input parameter is exceeded by the math function, and errno is set to ERANGE.