verified... it is wrong in GATE itself...
#include <stdio.h>
#define EOF -1
void push (int); /* push the argument on the stack */
int pop (void); /* pop the top of the stack */
void flagError ();
int main ()
{ int c, m, n, r;
while ((c = getchar ()) != EOF)
{ if (isdigit (c) )
push (c-'0');
else if ((c == '+') || (c == '*'))
{ m = pop ();
n = pop ();
r = (c == '+') ? n + m : n*m;
push (r);
}
else if (c != ' ')
flagError ();
}
printf("%d", pop ());
}
coming to your question
Guys in this question %c is there in printf.......and ans is 25.....but why the ASCII value of 25 is not printed?????
when %c is used.... character printed, when %d is used digits ( ASCII values in case of characters ) printed