C Tutorials and Sample Problems
Arrays
Instructions for doing this tutorial:
- Read the Discussion, which includes examples.
- There are a lot of details; try not to bog down, and return to this document as needed when working problems.
- Ask questions as needed.
- Read the Gotcha's — common errors when using arrays.
- Try not to bog down.
- Come back to this document if you are experiencing hard-to-debug errors when using arrays.
- Skim the Array Patterns.
- For now, just pick up what the patterns are, without worrying too much about how to implement the pattern.
- When you begin to solve a problem that uses arrays,
ask yourself whether any of the patterns you studied are relevant.
- Refer back to this document both to see which pattern(s) are relevant and also
to review how to implement those pattern(s).
- Review the Summary. Ask questions as needed.
- Do the first practice problem, as follows:
- Do Practice Problem 1 (TODO 1 and TODO 2) in the Practice Problems.
- You should be able to tell from running the program whether or not it is correct.
- If you are not able to get the program correct, ask questions before proceeding.
It is much better to ask questions than to just look at the answer.
- AFTER you believe that you have a correct solution to Practice Problem 1,
compare your answer to our Solution to Practice Problem 1.
Ask questions as needed.
- Do the second practice problem similarly, as follows:
- Do Practice Problem 2 (TODO 3 and TODO 4) in the Practice Problems.
- You should be able to tell from running the program whether or not it is correct.
- If you are not able to get the program correct, ask questions before proceeding.
It is much better to ask questions than to just look at the answer.
- AFTER you believe that you have a correct solution to Practice Problem 2,
compare your answer to our Solution to Practice Problem 2.
Ask questions as needed.
- Do the third practice problem similarly, as follows:
- Do Practice Problem 2 (TODO 5 and TODO 6) in the Practice Problems.
- You should be able to tell from running the program whether or not it is correct.
- If you are not able to get the program correct, ask questions before proceeding.
It is much better to ask questions than to just look at the answer.
- AFTER you believe that you have a correct solution to Practice Problem 2,
compare your answer to our Solution to Practice Problem 2.
Ask questions as needed.
Other information
For your convenience, here are links to the above documents as Microsoft Word 2007 documents (instead of PDF documents):
This document is part of a set of C tutorials developed by:
David Mutchler (David dot Mutchler at Rose-Hulman.edu)
Department of Computer Science and Software Engineering
Rose-Hulman Institute of Technology