Posts

Showing posts with the label infix to postfix

Stack Program #3

Image
17. Write a program to convert in-fix notation to post-fix notation using Stack. #include<stdio.h> #define N 50 char s[N]; int top=-1; void push(char); char pop(); int f(char); int g(char); int r(char); void main() {      int i=0,j=0,rank;      char infix[50],next,temp,x,polish[50];      top=0;      s[top]='(';      polish[50]='\0';      rank=0;      printf(" Enter a infix expression with extra closing bracket :\n");      scanf("%s",infix);      next=infix[i];      while(next!='\0')      {           if(top<0)           {                printf("Invalid\n");                return;           }           while(g(...