Here you should first check whether or not the stack

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: le inside the function will be “saved”. In other words, the value of the variable will also change outside the function if it is changed inside the function. Remember the basic rules of a stack. Only one end of the stack is “open”. You can only push things and pop things from one end. Using an array, you can “fix” one end, and push things from the other end. Go back to the diagrams on the first page of this handout. Assume that each diagram represents the state of the array after each stack operation. Let the left- most element be the first element in the array. In terms of the size variable, what do you think should be the position where the next element will be pushed? How will you test whether the stack is full or not? Work out all this on pap...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online