Hello. I am trying to run a simple postfix notation code. It builds but doesn't run. Can anyone tell me if it's my code that is stopping it from running?

Here is my code:

`int main(int argc, char *argv[]){`

        char *a = argv[1];
    int i, div, N = strlen(a);
    stack<int> save(N);

        cout << "Enter the postfix expression";
        cin >> a;

           for(i = 0; i<N; i++){
        if(a[i] == '+')
            save.push(save.pop() + save.pop());
        if(a[i] == '*')
            save.push(save.pop() * save.pop());
                if(a[i] == '-')
                        save.push(save.pop() - save.pop());
                if(a[i] == '/')
                        save.push(save.pop() / save.pop());
        if((a[i] >= '0') && (a[i] <= '9'))
            save.push(a[i] -'0');
        //while ((a[i] >= '0') && (a[i] <= '9'))
        //  save.push(10*save.pop() + (a[i++]-'0'));
           }

    cout << save.pop() <<endl;

    return 0;
}`

Probably there is a pointer error. Can you provide the code for struct save ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.