summaryrefslogtreecommitdiffstats
path: root/4
diff options
context:
space:
mode:
Diffstat (limited to '4')
-rw-r--r--4/4.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/4/4.c b/4/4.c
index b6b194d..0779ce0 100644
--- a/4/4.c
+++ b/4/4.c
@@ -145,13 +145,11 @@ int getop(char s[]) {
// numbers
if (isdigit(c) || c == '-') {
- if (c == '-') {
- // minus operator
- if (!isdigit(s[++i] = c = getch())) {
- ungetch(c);
- s[i] = 0;
- return '-';
- }
+ // minus operator
+ if (c == '-' && !isdigit(s[++i] = c = getch())) {
+ ungetch(c);
+ s[i] = 0;
+ return '-';
}
while (isdigit(s[++i] = c = getch()) || c == '.')