diff options
| author | Sadeep Madurange <smadurange@users.noreply.github.com> | 2021-12-18 15:10:16 +0800 |
|---|---|---|
| committer | Sadeep Madurange <smadurange@users.noreply.github.com> | 2021-12-18 15:10:16 +0800 |
| commit | ff5416cd1fea048c83fd608c3a3634091abc2cdc (patch) | |
| tree | ef80363339788354ec09df5e6ef2e9123a0c7d3a /4/10.c | |
| parent | a7dc7475b5b2ef5e4e4cd547581ccb11a13f6a95 (diff) | |
| download | k&r-exercises-ff5416cd1fea048c83fd608c3a3634091abc2cdc.tar.gz | |
4.10
Diffstat (limited to '4/10.c')
| -rw-r--r-- | 4/10.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -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; |
