We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7ac6052 commit 8461723Copy full SHA for 8461723
chapter04/4-4.c
@@ -129,6 +129,12 @@ void duplicateTop(void)
129
push(top2);
130
}
131
132
+/* clearStacK: clear the stack */
133
+void clearStack(void)
134
+{
135
+ sp = 0;
136
+}
137
+
138
/* reverse Polish Calculator */
139
int main(void)
140
{
@@ -174,6 +180,9 @@ int main(void)
174
180
case 's':
175
181
swapTopTwo();
176
182
break;
183
+ case 'c':
184
+ clearStack();
185
+ break;
177
186
case '\n':
178
187
printf("\t%.8g\n", pop());
179
188
0 commit comments