CSC 161 Grinnell College Fall, 2011
Imperative Problem Solving and Data Structures

Laboratory Exercise on Arrays


The goal of this lab is to introduce arrays to students.

Array Indices

  1. Copy the program, array-index.c. Write a paragraph explaining what this program does.
  2. What happens when you enter inappropriate index values to the array speed? You may want to try reasonably small errors (say index = 8) as well as ridiculous indices (say index = 123456789). Explain the results that you get.

Array Bounds

  1. Moving in Different Speeds

    The following program, array-move.c, makes the Scribbler move with certain speeds for certain times, which are in the corresponding indices of their arrays. Explain how this program is similar to and different from the program array-index.c from the previous question.

  2. Change the loop in the program so that it counts down, instead of up.
  3. Try changing the initialization numMoves, which tells the number of moves(it is now 8) to different numbers and see what happens.

Musical Arrays

  1. Play a Song with the Help of an Array

    Copy the program fragment array-notes.c, and use it to write a program which plays the song with 0.5 second notes.

  2. What is the resulting song?

Array Order

  1. Making a Reverse Movie

    Write a program that tells the Scribbler to take and store 6 photos by turning in a circle, and showing them in reverse order. Taking the pictures and showing them should be done with two seperate loops. Below are some things you need to know in order to write this program:

Reminder: Complete Evaluation Form

When you have finished this lab, be sure to fill out its evaluation form in the "Lab Evaluation" section for CSC 161 on Pioneer Web.

This document is available on the World Wide Web as

created 19 July 2011 by Dilan Ustek
last revised 18 September 2011 by Henry Walker
Valid HTML 4.01! Valid CSS!
For more information, please contact Henry M. Walker at