Homework 20: Stack-based arrays
Name: _____________________________________________ Alpha: ___________________
Describe help received: ________________________________________________________
- Due before class on Monday, March 6
- This homework contains code to be submitted electronically.
Put your code in a folder called
hw20
and submit using the204sub
command. - This is an electronic homework and you do not need to print out anything to turn in during class.
Assignment
- Required reading: Sections 1 (Stack-based arrays) and 2 (Strings are arrays) from the Unit 6 notes,
-
Write a program
reverse.c
that reads in an integer for the size of your array, then declares and array ofint
s of that size, reads then in, and then prints them back out in reverse order.Example runs:
roche@ubuntu$
./reverse
How many numbers?
4
Enter 4 numbers:
1 2 3 4
4
3
2
1
roche@ubuntu$
./reverse
How many numbers?
7
Enter 7 numbers:
5 8 2 1 3 9 6
6
9
3
1
2
8
5
roche@ubuntu$
./reverse
How many numbers?
1
Enter 1 numbers:
3
3