I made a C program to evaluate a postfix expression. The output is wrong. I have added print messages at various places to see where Iam going wrong. Turns out at the 4th or 5th line of the for loop body. I can't understand why it is happening.
 #include <stdio.h>
 #include <string.h>
  char exp[20];
 int stck[15];
 int tos = -1;
 int isEmpty() {
   if (tos == -1)
     return 1;
   return 0;
 }
 int isFull() {
   if (tos == 9)
     return 1;
   return 0;
 }
 int pop() {
   if (!(isEmpty()))
     return stck[tos--];
   else
     printf("Underflow\n");
 }
 void push(int c) {
   if (!(isFull()))
     stck[++tos] = c;
   else
     printf("Overflow\n");
 }
 int isOperator(char c) {
   if (c == '+' || c == '-' || c == '/' || c == '%' || c == '*')
     return 1;
   return 0;
 }
 main() {
   int i, a, b, c;
   printf("Enter the expression\n");
   gets(exp);
   for (i = 0; exp[i] != '\0'; i++) {
     printf("Current symbol is %c\n", exp[i]);
     if (!(isOperator(exp[i]))) {
       push((int) exp[i]);
       printf("Pushed %d into the stack\n", stck[tos]);
     } else {
       b = pop();
       a = pop();
       printf("Value of a and b are : %d and %d \n", a, b);
       if (exp[i] == '+')
         c = a + b;
       if (exp[i] == '-')
         c = a - b;
       if (exp[i] == '*')
         c = a * b;
       if (exp[i] == '/')
         c = a / b;
       if (exp[i] == '%')
         c = a % b;
       push(c);
       printf("C pushed. top of stack is now %d\n", stck[tos]);
     }
   }
   printf("The value of expression is: %d\n", pop());
 }
 
     
    