From 3bda511d9ed826062176e18a285278531473253a Mon Sep 17 00:00:00 2001 From: Sadeep Madurange Date: Fri, 10 Dec 2021 19:44:06 +0800 Subject: 4.4 --- 4/4.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to '4') diff --git a/4/4.c b/4/4.c index b6b194d..0779ce0 100644 --- a/4/4.c +++ b/4/4.c @@ -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 == '.') -- cgit v1.2.3