summaryrefslogtreecommitdiffstats
path: root/4/11.c
diff options
context:
space:
mode:
authorSadeep Madurange <smadurange@users.noreply.github.com>2021-12-22 22:48:05 +0800
committerSadeep Madurange <smadurange@users.noreply.github.com>2021-12-22 22:48:05 +0800
commit184e8656337f33654b849f00abcc6f6df3c17432 (patch)
tree6dc13a3fd8c7b0a01ce2d57e75ff39d65acb5bee /4/11.c
parent15b4797078428bf586b6e76c54c61958994251c7 (diff)
downloadk&r-exercises-184e8656337f33654b849f00abcc6f6df3c17432.tar.gz
4.11
Diffstat (limited to '4/11.c')
-rw-r--r--4/11.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/4/11.c b/4/11.c
index 7c9d777..301751c 100644
--- a/4/11.c
+++ b/4/11.c
@@ -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;
}
}