diff options
| author | Sadeep Madurange <smadurange@users.noreply.github.com> | 2021-12-12 12:50:26 +0800 |
|---|---|---|
| committer | Sadeep Madurange <smadurange@users.noreply.github.com> | 2021-12-12 12:50:26 +0800 |
| commit | 8f900a76d3e78cc01f2a6e9f237ce57da468a078 (patch) | |
| tree | 55e8d5f0fd6103c10badbea8adff91c0c785348c | |
| parent | 89bcb7ebbdb05d86b5e8999f3ccf94fd9d9d0821 (diff) | |
| download | k&r-exercises-8f900a76d3e78cc01f2a6e9f237ce57da468a078.tar.gz | |
4.7
| -rw-r--r-- | 4/7.c | 7 |
1 files changed, 1 insertions, 6 deletions
@@ -187,7 +187,6 @@ int getop(char s[]) { return c; i = 0; - // numbers if (isdigit(c) || c == '-') { // minus operator @@ -196,7 +195,6 @@ int getop(char s[]) { s[i] = 0; return '-'; } - while (isdigit(s[++i] = c = getch()) || c == '.') ; rv = NUMBER; @@ -205,9 +203,7 @@ int getop(char s[]) { int count; for (count = 0; isalnum(s[++i] = c = getch()); count++) ; - int islout = strncmp("lout", s, 4 * sizeof(char)) == 0; - if (count == 0 || islout) { if (islout) rv = VARIABLE; @@ -218,7 +214,7 @@ int getop(char s[]) { if (c != '\n') { ungetch(c); ungetch(nc); - } + } rv = VARIABLE; } } else { @@ -227,7 +223,6 @@ int getop(char s[]) { } s[i] = 0; - if (c != EOF) ungetch(c); |
