计算用逆波兰表示法表示的运算,如输入12+34/*,那么就相当于(1+2)*(3-4),输出-3

我自己写的代码无法实现,用栈的思想解决,求大佬指点
这是代码,大佬多多指点

#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int S[1000],top; //S数组表示栈//

void push(int x) //入栈//
{
S[++top]=x;
}

int pop() //出栈//
{
top--;
return S[top+1];
}

void execute(char* s); //执行逆波兰运算//
{
for(int i=0;i<100;i++)
{
    if(s[i]=='+')
    {
    a=pop();
    b=pop();
    push(a+b);
    }
    else if(s[i]=='-')
    {
    a=pop();
    b=pop();
    push(a-b);
    }
    else if(s[i]=='*')
    {
    a=pop();
    b=pop();
    push(a*b);
    }
    else push(atoi(s));
}

}
int main()
{
top=0;
int a,b;
char s[100];
scanf("%s",s);
execute(s);
printf("%d\n",pop()); //输出结果//
return 0;
}

https://download.csdn.net/download/caozhy/10191105