summaryrefslogtreecommitdiffstats
path: root/4/10.c
diff options
context:
space:
mode:
Diffstat (limited to '4/10.c')
-rw-r--r--4/10.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/4/10.c b/4/10.c
index 83a9053..c89bf0b 100644
--- a/4/10.c
+++ b/4/10.c
@@ -50,8 +50,8 @@ int main(int argc, char *argv[]) {
push(op1 + op2);
break;
case '-':
- op1 = pop();
op2 = pop();
+ op1 = pop();
push(op1 - op2);
break;
case '*':
@@ -147,7 +147,7 @@ int getop(char s[]) {
// special characters and operators
if (c == 0 || c == '+' || c == '*' || c == '/' || c == '%' || c == '\n' ||
- (c == '-' && !isdigit(line[idx + 1])) || c == EOF)
+ (c == '-' && !isdigit(line[idx])) || c == EOF)
return c;
i = 0;