Chapter
Arrays of Structures
From ComputerScienceOne by Dr Chris Bourke
Concepts
- How do you create and use an array of structures in C?
"Just as we can create arrays of built-in types such as integers, we can also create arrays of our user-defined structures. As an example, the following creates an array of 10 Student structures. Once
- How can an array of structure pointers make swapping structures more efficient?
"As an alternative, we could instead deal indirectly with structures by creating an array of pointers to structures. Swapping elements then involves only copying pointer values rather than every byte
- How can you combine contiguous structure storage with indirect access?
"It is also possible to take a “hybrid” approach to storing structures in arrays that stores them both contiguously, but also allows you to reference them indirectly through a pointer array. This is e