summaryrefslogtreecommitdiffstats
path: root/4
diff options
context:
space:
mode:
Diffstat (limited to '4')
-rw-r--r--4/2.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/4/2.c b/4/2.c
index 2f94001..3a3fa0b 100644
--- a/4/2.c
+++ b/4/2.c
@@ -49,7 +49,10 @@ double atof(char s[]) {
exp_sign = s[i] == '-' ? -1 : 1;
- for (i++, exp = 0; isdigit(s[i]); i++)
+ if (s[i] == '-' || s[i] == '+')
+ i++;
+
+ for (exp = 0; isdigit(s[i]); i++)
exp = 10 * exp + (s[i] - '0');
if (exp_sign < 0)