[Solved] Infix to Postfix conversion – segmentation fault [closed]

[ad_1]

The issue is you are not setting top properly, in your constructor you declared a local top which left stack::top uninitialized.

 stack(){
        int top=-1;  //
    }

update to below code, should work:

   stack() {
        top = -1;
    }

1

[ad_2]

solved Infix to Postfix conversion – segmentation fault [closed]