summaryrefslogtreecommitdiffstats
path: root/4/4.c
diff options
context:
space:
mode:
authorSadeep Madurange <smadurange@users.noreply.github.com>2021-12-10 20:04:03 +0800
committerSadeep Madurange <smadurange@users.noreply.github.com>2021-12-10 20:04:03 +0800
commit6964f62932f5d1fd9989905478fd19895fc10199 (patch)
tree7e2c39da284476beafa422113889a76f3da140d8 /4/4.c
parent36ad2d4eb0300d778eaf58496658687600929929 (diff)
downloadk&r-exercises-6964f62932f5d1fd9989905478fd19895fc10199.tar.gz
4.4
Diffstat (limited to '4/4.c')
-rw-r--r--4/4.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/4/4.c b/4/4.c
index d80fccd..221eec6 100644
--- a/4/4.c
+++ b/4/4.c
@@ -30,8 +30,8 @@ double peek();
/* clears the stack */
void clear();
-/* adds commands peek (print top val without popping), dup (duplicate top val),
- * swap (swap top two stack positions), clear (clear stack) */
+/* adds commands "top" (print top val without popping), "dup" (duplicate top val),
+ * "swp" (swap top two stack positions), "cls" (clear stack) */
int main(int argc, char *argv[]) {
int type;
double op2, op1;
@@ -67,16 +67,16 @@ int main(int argc, char *argv[]) {
printf("error: division by zero\n");
break;
case FUNCTION:
- if (strcmp("peek", s) == 0)
+ if (strcmp("top", s) == 0)
peek();
else if (strcmp("dup", s) == 0)
push(peek());
- else if (strcmp("swap", s) == 0) {
+ else if (strcmp("swp", s) == 0) {
op2 = pop();
op1 = pop();
push(op2);
push(op1);
- } else if (strcmp("clear", s) == 0)
+ } else if (strcmp("cls", s) == 0)
clear();
else
printf("error: unknown function %s\n", s);