RosettaCodeData/Task/Determine-if-a-string-is-numeric/C/determine-if-a-string-is-numeric.c
2024-04-19 16:56:29 -07:00

12 lines
228 B
C

#include <ctype.h>
#include <stdbool.h>
#include <stdlib.h>
bool isNumeric(const char *s) {
if (s == NULL || *s == '\0' || isspace(*s)) {
return false;
}
char *p;
strtod(s, &p);
return *p == '\0';
}