Program For Converting Infix To Postfix Expression
Program For Converting Infix To Postfix Expression
#include<stdio.h>
#include<stdlib.h> /* for exit() */
#include<ctype.h> /* for isdigit(char ) */
#include<string.h>
if(top <0)
{
printf("stack under flow: invalid infix expression");
getchar();
/* underflow may occur for invalid expression */
/* where ( and ) are not matched */
exit(1);
}
else
{
item = stack[top];
top = top-1;
return(item);
}
}
i=0;
j=0;
item=infix_exp[i]; /* initialize before loop*/
InfixToPostfix(infix,postfix); /* call to
convert */
printf("Postfix Expression: ");
puts(postfix); /* print postfix
expression */
return 0;
}