Week 11: Lists and arrays
C code typing course. 20 wpm, 93% accuracy.
An array holds several values of the same type under one name. Its items sit between curly braces and are separated by commas. In C, the first item has the index 0, and the last index is one less than the number of items. This week you learn to type [, ] and , on the US English layout, and you practice reading items by their index.
What you will learn
On the US English layout:
[: the [ key, with your right pinky.]: the ] key, with your right pinky.,: the , key, with your right middle finger.
A line that declares an array of three grades:
int grades[3] = {90, 85, 70};
The first grade is read with grades[0], and that gives 90.
Technique tips
- When you type
[, close it right away, then fill in the number. This way thegrades[part and the closing]stay easy to check. - Keep your right pinky steady for both brackets, and keep the rest of your fingers on the home row.
- Put a space after each comma in the list of values. The spacing makes it obvious where each item starts.
- Check the screen. Make sure the closing brace at the end of the declaration is there before you move on.
Lessons
- Lesson 1, learn (10 to 15 minutes): Watch the
[,]and,keys on the keyboard demo. Type each symbol five times. - Lesson 2, practice (10 to 15 minutes): Type
grades[0],grades[1]andgrades[2]. Then type the three-item declaration from the example. - Lesson 3, review (10 to 15 minutes): Take the two-minute test with array lines. Save your result and practice the brackets you got wrong.
This week’s goal
This week’s target is 20 WPM and 93% accuracy. Finishing the week’s lessons earns you 1 star. Reach 93% accuracy for 2 stars, and also reach 20 WPM for 3 stars. A wrong number inside the brackets makes the program read a different item, so type each index carefully.
Symbols this week
The colored keys are the ones you learn this week. The color shows which finger presses the key.
This week’s lessons
Do the lessons in order. Each one ends with a test, and your best result is saved.