{{keywords>wiki library source code example reference}}
====== strerror ======
#include
//#include /* uncomment this for Windows */
char *strerror(int errnum);
=== Description ===
returns a pointer to a string that describes the error code passed in the argument errnum
compile this example with the compiler flag **-lm**
===== strerror C Example Code =====
/*
* strcspn c example code
* http://code-reference.com/c/string.h/strerror
*/
#include
#include
#include
#include
int main ( void ) {
double i;
i = sqrt(-1);
printf("sqrt(-1)=%f\n",i);
printf("%s\n", strerror(errno));
return 0;
}
=== Output of strerror example ===
sqrt(-1)=-nan
Numerical argument out of domain