diff options
| author | Sadeep Madurange <smadurange@users.noreply.github.com> | 2021-12-07 18:33:22 +0800 |
|---|---|---|
| committer | Sadeep Madurange <smadurange@users.noreply.github.com> | 2021-12-07 18:33:22 +0800 |
| commit | 8bdf87a53e221091f76227299e6864c87ec75bf2 (patch) | |
| tree | c7033575c149510e0af6cbb98b3ee42d39eb9acf /4/3.c | |
| parent | bd9550e2e7f2484ccbd6f9c6d1d2a520dbddc82c (diff) | |
| download | k&r-exercises-8bdf87a53e221091f76227299e6864c87ec75bf2.tar.gz | |
4.3
Diffstat (limited to '4/3.c')
| -rw-r--r-- | 4/3.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -98,7 +98,7 @@ int getop(char s[]) { ; s[1] = 0; - if (!isdigit(c) && c != '.') + if (!isdigit(c) && c != '.' && c != '-') return c; i = 0; @@ -108,6 +108,9 @@ int getop(char s[]) { if (c == '.') while (isdigit(s[++i] = c = getch())) ; + if (c == '-') + while (isdigit(s[++i] = c = getch())) + ; s[i] = 0; if (c != EOF) |
