C Program to Evaluate the Postfix Expression...

#define maxi 100

struct stack
int ar[maxi];
int t;

void push(struct stack *p,int c)
   printf("\n Stack Overflow.");

int pop(struct stack *p)
  return p->ar[p->t--];

int peep(struct stack p)
  { return p.ar[p.t]; }

int isoperator(char c)
  return 1;
  return 0;

void main()
 struct stack s;
 char a[100];
 int i;
printf("Enter any expression..");
 else if(isoperator(a[i])){
 int b,c,ans;
 case '+':{ans=c+b;break;}
 case '-':{ans=c-b;break;}
 case '*':{ans=c*b;break;}
 case '/':{ans=c/b;break;}
 case '%':{ans=c%b;break;}
printf("\nThe result of the expression is..%d",pop(&s));

No comments:

Post a Comment