From ff5416cd1fea048c83fd608c3a3634091abc2cdc Mon Sep 17 00:00:00 2001 From: Sadeep Madurange Date: Sat, 18 Dec 2021 15:10:16 +0800 Subject: 4.10 --- 4/10.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/4/10.c b/4/10.c index f4946ce..6297ee1 100644 --- a/4/10.c +++ b/4/10.c @@ -34,7 +34,8 @@ int getop(char[]); - press enter to print the value at the top of the stack. */ int main(int argc, char *argv[]) { - int type, op1, op2; + int type; + double op1, op2; char s[MAXOP]; while (mgetline()) { @@ -153,9 +154,8 @@ int getop(char s[]) { i = 0; - if (isdigit(c) || c == '-' || (c == '.' && isdigit(line[idx + 1]))) { - while (isdigit((s[++i] = c = line[idx++])) || - (c == '.' && isdigit(line[idx + 1]))) + if (isdigit(c) || c == '-' || c == '.') { + while (isdigit((s[++i] = c = line[idx++])) || c == '.') ; idx--; rc = NUM; -- cgit v1.2.3