p13 (Postfix Expression Evaluation)
p13 (Postfix Expression Evaluation)
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<ctype.h>
#define MAX 20
int s[MAX],top=0;
int pop();
void main()
scanf("%s",postfix);
ch=postfix[i];
push(ch-'0');
else
op2=pop();
op1=pop();
switch(ch)
case '+':
break;
case '-':
res=op1-op2;
break;
case '*':
res=op1*op2;
break;
case '/':
break;
case '^':
break;
default:
push(res);
++top;
s[top]=element;
int pop()
int elements;
elements=s[top];
--top;
return(elements);
}
OUTPUT