Supply appropriate definitions for push() and pop() functions and auxiliary exte
ID: 3611172 • Letter: S
Question
Supply appropriate definitions for push() and pop() functionsand auxiliary external variable definitions, so that push() andpop() implement the Stack ADT operations using an array and thefollowing main function works. (You may assume that at every pointin the execution there will never have been more than 10 morepush()'es than pop()'s).
int main() {
char s[6];
int x;
while(scanf("%5s", s) == 1) {
if(isdigit(s))
push(atoi(s));
else {
switch(s[0]) {
case '+': push(pop() + pop()); break;
case '*': push(pop() * pop()); break;
case '-':
x = pop();
push(x-pop());
break;
case '/':
x= pop();
push(x-pop());
break;
default:
return;
}
}
}
}