diff options
author | Daniel <steew0x8@protonmail.com> | 2021-11-06 00:43:50 +0100 |
---|---|---|
committer | Daniel <steew0x8@protonmail.com> | 2021-11-06 00:43:50 +0100 |
commit | bedbeb372f1d3a36b10d8737a9199c1fe4827e4f (patch) | |
tree | 74ec4127a83c0ba269c76a1e5ac4835069d90965 /util.c | |
parent | ab903e904fa4b994497bff231447db49d7040fa4 (diff) | |
download | rpncalc-bedbeb372f1d3a36b10d8737a9199c1fe4827e4f.tar.gz |
started working on a binary tree
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/util.c b/util.c index c4dd940..6b6cd37 100644 --- a/util.c +++ b/util.c @@ -1,7 +1,8 @@ #include "util.h" #include <math.h> +#include <string.h> -char OPERATOR_LIST[] = { +const char OPERATOR_LIST[] = { '+', '-', '*', @@ -9,12 +10,11 @@ char OPERATOR_LIST[] = { 0 }; -int is_decimal(char *s) { - for (int i = 0; s[i] != 0; i++) { - if (s[i] == ',' || s[i] == '.') return 1; - } - return 0; -} +const command COMMAND_LIST[] = { + {'c', "clear stack"}, + {'p', "pop last element"}, + {0, 0}, +}; int is_operator(char *s) { for (int i = 0; OPERATOR_LIST[i] != 0; i++) { @@ -26,5 +26,5 @@ int is_operator(char *s) { TYPE discriminate(char *s) { if (is_operator(s)) { return OPERATOR; - } else return DOUBLE; + } else return FUNCTION; } |