Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 14. Case Study 1—A Student Grade... > 14.3 A SUITABLE DATA STRUCTURE

14.3 A SUITABLE DATA STRUCTURE

In Chapter 5, we used arrays to store lists; this might be a suitable choice here since the size is to be specified and the data set is not large. There are two data items for each individual, name and grade. We could create a 'record' structure having two fields for the purpose, and Case Study 2 (Chapter 15) will use that approach. However, an alternative uses two 'parallel' arrays, one for grades and the other for names, where the same subscript defines an individual's data for both arrays (Figure 14.1).

Figure 14.1. Parallel arrays for the list



  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint