+DS 08 Infix Postfix
+DS 08 Infix Postfix
PROGRAM
#include<stdio.h>
#define MAX 100
char stack[MAX];
int top=-1;
char pop()
{
if (top<0)
{
printf("Stack underflow\n");
return -1;
}
else
{
return stack[top--];
}
}
int precedence(char operator)
{
switch(operator)
{
case '+':
case '-': return 1;
case '*':
case '/': return 2;
case '^': return 3;
default : return 0;
}
}
int main()
{
char infix[MAX], postfix[MAX], ch ,temp;
int i=0, j=0;
push(ch);
}
}
while (top!= -1)
postfix[j++]=pop();
OUTPUT