c/error/errno

is a preprocessor macro (but see note below) that expands to a modifiable lvalue of type. Several standard library functions indicate errors by writing positive integers to. Typically, the value of is set to one of the error codes listed in  as macro constants beginning with the letter  followed by uppercase letters or digits.

The value of is  at program startup, and although library functions are allowed to write positive integers to  whether or not an error occurred, library functions never store  in.

Library functions perror and strerror can be used to obtain textual descriptions of the error conditions that correspond to the current value.

Note: Until C11, the C standards had contradictory requirements, in that they said that is a macro but also that "it is unspecified whether  is a macro or an identifier declared with external linkage". C11 fixes this, requiring that it be defined as a macro (see also WG14 N1338).