You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
331 B
19 lines
331 B
#include <stdbool.h> |
|
#include <unistd.h> |
|
#include <ctype.h> |
|
#include <stdlib.h> |
|
|
|
bool is_float(const char *string) { |
|
if (string == NULL) { |
|
return false; |
|
} |
|
char *endptr; |
|
strtod(string, &endptr); |
|
if (string == endptr) { |
|
return false; |
|
} |
|
while (isspace((unsigned char ) *endptr)) { |
|
endptr++; |
|
} |
|
return *endptr == '\0'; |
|
}
|
|
|