You code is hardly readble, still, I think, you need to change
scanf("%c",a[j]);
to
scanf(" %c",&a[j]); //note the space before %c, and scanf() expects pointer
for
&
because as per thescanf()
signature, it needs the address to store the scanned result.- leading space [
] to stop scanning the previously pressed ENTER [
\n
] key.
Kindly Check the man page of scanf()
for more details.
Also, as mentioned in Mr. @LPs ‘s answer, usage of push(atoi(a));
is very dangerous, in case a
is not null-terminated.
solved can anyone find why is ths program to solve postfix expression giving runtime error