code for a character stack structure