X hits on this document

164 views

0 shares

0 downloads

0 comments

57 / 63

Copyright ©2004 Pearson Addison-Wesley. All rights reserved.

8-57

Partially Filled Arrays

Frequently, a program will need to process many lists of similar data

These list may not all be the same length

In order to reuse an array for processing more than one data set, the programmer often declares an array large enough to hold the largest data set anticipated.

This array can be used for processing shorter lists as well, provided that the program keeps track of how many array elements are actually in use.

One way to do this is to have the original array size declared as the highest needed, and then store a sentinel value after the last value inputted.

Document info
Document views164
Page views164
Page last viewedFri Dec 09 18:53:10 UTC 2016
Pages63
Paragraphs754
Words4119

Comments