Ds 1
Ds 1
Roll no – 02
Class – SE _D
Theory :
#include<stdio.h>
Char stack[100];
Void push(char x)
Stack[++top] = x
Char pop()
If(top == -1)
Return -1;
Else
Return stack[top--];
int priority(char x)
if(x == '(')
return 0;
return 1;
return 0;
int main()
char exp[100];
char *e, x;
scanf("%s",exp);
printf("\n");
e = exp;
while(*e != '\0)
if(isalnum(*e))
printf("%c ",*e);
push(*e);
else
printf("%c ",pop());
push(*e);
}
e++;
while(top != -1)
printf("%c ",pop());
}return 0;