diff options
| author | Sadeep Madurange <smadurange@users.noreply.github.com> | 2021-12-22 22:48:05 +0800 |
|---|---|---|
| committer | Sadeep Madurange <smadurange@users.noreply.github.com> | 2021-12-22 22:48:05 +0800 |
| commit | 184e8656337f33654b849f00abcc6f6df3c17432 (patch) | |
| tree | 6dc13a3fd8c7b0a01ce2d57e75ff39d65acb5bee | |
| parent | 15b4797078428bf586b6e76c54c61958994251c7 (diff) | |
| download | k&r-exercises-184e8656337f33654b849f00abcc6f6df3c17432.tar.gz | |
4.11
| -rw-r--r-- | 4/11.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -129,7 +129,7 @@ int getop(char s[]) { static int pc = ' '; if (pc != ' ' && pc != '\t') { - c = pc; + s[0] = c = pc; pc = ' '; } else { while ((s[0] = c = getch()) == ' ' || c == '\t') @@ -153,7 +153,7 @@ int getop(char s[]) { ; s[i] = 0; if (i == 1) { - if ((c = getch()) == '=') + if (c == '=' || (c = getch()) == '=') rc = '='; else { pc = c; @@ -161,7 +161,7 @@ int getop(char s[]) { } } else { pc = c; - rc = strcmp("LOUT", s) == 0 || strlen(s) == 1 ? VAR : FUN; + rc = strcmp("LOUT", s) == 0 ? VAR : FUN; } } |
