DSA Infix To Postfix
DSA Infix To Postfix
MIS – 112415033
#include <stdio.h>
#include <ctype.h>
#include <string.h>
typedef struct {
char arr[MAX];
int top;
} Stack;
int precedence(char c) {
switch (c) {
case '+':
case '-': return 1;
case '*':
case '/': return 2;
case '^': return 3;
default: return 0;
}
}
int main() {
char infix[MAX], postfix[MAX];
printf("Enter an infix expression: ");
scanf("%s", infix);
ITP(infix, postfix);
printf("Postfix expression: %s\n", postfix);
return 0;
}
OUTPUT:-