summaryrefslogtreecommitdiffstats
path: root/4
diff options
context:
space:
mode:
authorSadeep Madurange <smadurange@users.noreply.github.com>2021-12-12 12:50:26 +0800
committerSadeep Madurange <smadurange@users.noreply.github.com>2021-12-12 12:50:26 +0800
commit8f900a76d3e78cc01f2a6e9f237ce57da468a078 (patch)
tree55e8d5f0fd6103c10badbea8adff91c0c785348c /4
parent89bcb7ebbdb05d86b5e8999f3ccf94fd9d9d0821 (diff)
downloadk&r-exercises-8f900a76d3e78cc01f2a6e9f237ce57da468a078.tar.gz
4.7
Diffstat (limited to '4')
-rw-r--r--4/7.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/4/7.c b/4/7.c
index 9ddc2bb..c19baa1 100644
--- a/4/7.c
+++ b/4/7.c
@@ -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);