K&R C Programs Exercise 4-4
Exercise 4-4. Add commands to print the top element of the stack without popping it, to duplicate it, and to swap the top two elements. Add a command to clear the stack. Four new commands, each operating directly on the stack array. None requires new data structures — just index arithmetic on val[] and sp. …