Concept

How can you combine contiguous structure storage with indirect access?

ComputerScienceOne / Arrays of Structures

"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 essentially what we did in Section 20.4.1 when we created a contiguous 2-dimensional array of integers. We made a single call to malloc and then had to setup the pointers to each “row.” To do this with structures, we can do something similar. First, we declare and allocate a dynamic array as before.\n\nint n = 10;\n\nStudent *rosterData = (Student *) malloc(n * sizeof(Student));"

Related Ideas

How can you combine contiguous structure storage with indirect access? | ComputerScienceOne | Bifalgorithm | Bifalgorithm