Recap of Arrays

What We’ve Covered So Far

To declare an array:

To declare an array with values:

To insert values into an array:

Arrays need a null value at the end so Sparki knows when to stop!

stop sign

Programmers often use arrays to store information and then they have to write code to look through that information.

Questions and Activities to Try

1. Store your name as a character array and have Sparki print it out on the LCD.

2. Add your last name to the array above using code that looks something like this: 3. Make the array searching code with the for loop (See Searching Through Arrays above) work for your name- search through your name for a couple different letters. Then enter someone else’s name and make sure the code still works with this different name. Try this a couple different times. (Don’t worry if one of the names doesn’t have the letter Sparki is searching for, that will result in just the name being printed out.)

Next Step:

Now that we know what variables are, let’s see what you can do with them:

Next Lesson – Functions