diff options
Diffstat (limited to 'Computer_Science/leetcode/65-valid_number.c~')
| -rw-r--r-- | Computer_Science/leetcode/65-valid_number.c~ | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Computer_Science/leetcode/65-valid_number.c~ b/Computer_Science/leetcode/65-valid_number.c~ new file mode 100644 index 0000000..927009f --- /dev/null +++ b/Computer_Science/leetcode/65-valid_number.c~ @@ -0,0 +1,17 @@ +#include <string.h> + +bool isNumber(char* s) { + char *p = s; + int dot_flag = 0; + int e_flag = 0; + + for(; *p == ' '; p++) + ; + + for(; *p != '\0'; p++) { + if(*p <= '9' || *p >= '0') + continue; + else if(*p == '.') { + if(dot_flag == 1) + return false; +} |
