![]() |
VOOZH | about |
In C, perror() is a built-in function used to display a custom text description of the error code, which is stored in the system variable errno.
Example:
Output
An error occurred: No such file or directoryTable of Content
clearerr() is a standard library function defined in <stdio.h> file.
perror("message");
This function does not return any value.
The following examples demonstrate the use of perror() in our C programs:
Output
Memory allocation failed: Cannot allocate memory
Output
Error creating file: Permission denied