Question:
I have to read in integers and be able to add them to the front of the array. How do I do this?
Answer:
You can either use the array in reverse order and simply append new items to the end of the array, or you can set the size of the array in advance and simply write items to the end of the array and work up.
If you want to insert items at the head of the array, there is no direct way to do this. You could shift everything down to make room, but this can be inefficient when the array gets large. Another approach to consider is to use a linked list instead. Items can be inserted into a linked list without shifting existing items.