Stack infix to postfix code not running

before accessing top value of stack i think you need to check if stack is empty or not