Chapter 12

Give Me Arrays

IN THIS CHAPTER

check Storing multiple variables in an array

check Creating an array

check Understanding character arrays

check Sorting values in an array

check Working with multidimensional arrays

check Sending an array to a function

When I first learned to program, I avoided the topic of arrays. They didn’t make sense to me. Array variables sport their own methods and madness, which is different from working with single variables in C. Rather than shun this topic and skip ahead to the next chapter (which isn’t any easier), consider embracing the array as a lovely, weird, and useful tool.

Behold the Array

Humans enjoy grouping things, mostly done by type: People collect spoons, for example, or coins or husbands. These items are easily grouped because they’re of similar types. The C language, too, has ways to group values of similar types, like a row of variables in a queue. The word used ...

Get C Programming For Dummies, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.