C string strerror() function
Example
Output a variety of error messages:
printf("%s\n", strerror(0));
printf("%s\n", strerror(1));
printf("%s\n", strerror(2));
printf("%s\n", strerror(3));
Try it Yourself »
Definition and Usage
The strerror() function returns a string describing the meaning of an error code.
The strerror() function is defined in the <string.h> header file.
Syntax
strerror(int errcode);
Parameter Values
| Parameter | Description |
|---|---|
| errcode | Required. An error code. |
Technical Details
| Returns: | A pointer to a string describing the meaning of the error code. |
|---|