5.46 · exercise
Stack of plates
Four plates go into main's stack frame, the space on the stack it sets aside for itself, and they come back out top-first. The starter reads the plates one at a time into plate_r; each read overwrites the plate before it, so store every plate in its named stack slot before the next read comes in. Then load them back and print them in reverse order.
The starter already sizes the frame, rounded up to a multiple of 16, and gives each slot a named offset. Your job is the strs going in and the ldrs coming out; the printing order is what makes it a stack.
What is checked
- four lines,
89,55,34,21, for the plates in the stdin box - the program exits cleanly
- the plates go into the frame with
str - the same holds for other plates you do not see, zeros and the largest and smallest 64-bit values among them
specification
stdin21 34 55 89
stdoutprints the right output
exitexits with the right code
sourceuses
strhiddenright output and exit code on 4 more inputs you do not see
We run your program on the input above and on the hidden ones, and compare what it does. Nothing is matched against a stored solution.