RosettaCodeData/Task/Determine-if-a-string-is-numeric/C/determine-if-a-string-is-numeric.c

11 lines
195 B
C
Raw Permalink Normal View History

2013-04-10 12:38:42 -07:00
#include <ctype.h>
#include <stdlib.h>
int isNumeric (const char * s)
{
if (s == NULL || *s == '\0' || isspace(*s))
return 0;
char * p;
strtod (s, &p);
return *p == '\0';
}