Code related problem

in line 37 , when i remove the element from stack i am getting segmentation fault.

i want to remove the element from stack when my condition satisfied.

tell me, where i am wrong