aboutsummaryrefslogtreecommitdiff
path: root/Computer_Science/leetcode/65-valid_number.c~
blob: 927009ff5d03bfd2a9ec159212822fad5af99bce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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;
}