diff options
| -rw-r--r-- | 4/4.c | 12 |
1 files changed, 5 insertions, 7 deletions
@@ -145,13 +145,11 @@ int getop(char s[]) { // numbers if (isdigit(c) || c == '-') { - if (c == '-') { - // minus operator - if (!isdigit(s[++i] = c = getch())) { - ungetch(c); - s[i] = 0; - return '-'; - } + // minus operator + if (c == '-' && !isdigit(s[++i] = c = getch())) { + ungetch(c); + s[i] = 0; + return '-'; } while (isdigit(s[++i] = c = getch()) || c == '.') |
