Working with Arrays

We have already seen how a structure is a grouping of one or more components that can eachbe of different data types. Often, we need a grouping that consists of the same type; this is called anarray. An array is a collection of multiple occurrences of the same data type grouped together under a single name. Each element of the array is accessed via its basename and an offset of that base. Arrays have many uses, from organizing homogenous data types to providing the basis for strings, or arrays of characters.

Before we can learn about some of the wide uses of arrays, we need to explore the basics of declaring and manipulating arrays.

The following topics will be covered in this chapter:

  • Declaring an array of values

Get Learn C Programming 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.