Skip to main content

Introduction

In this chapter we will create complex aggregate types that involve multiple types and structures that allow us to represent larger sets of related data.

We will discuss different ways to do this and the advantages and disadvantages of various methods.

Learning Outcomes

After completing this chapter, students will be able to:

  1. Declare and initialize structs containing array members using proper C syntax and understand how arrays can be packaged within struct definitions
  2. Access array elements within structs using dot (.) and arrow (->) operators combined with array subscript notation
  3. Use parallel arrays by declaring multiple arrays to store related data at corresponding indices and identify situations where parallel arrays are appropriate
  4. Implement functions that work with parallel arrays by passing multiple arrays as parameters and maintaining data relationships across arrays
  5. Declare and initialize arrays of structs using nested initialization syntax and recognize when arrays of structs are preferable to parallel arrays
  6. Write functions that operate on arrays of structs by passing the array as a parameter and accessing struct members through array indices