Suppose we have a List class with private data dataArray (an array holding the l
ID: 3553355 • Letter: S
Question
- Suppose we have a List class with private data dataArray (an array holding the list items) and length (a variable indicating the current list length). Additionally, you can assume that "!=" is defined appropriately for ItemType. What does the following function do?
void List::Mystery( ItemType alpha, bool& result ){ int index = 0; while (index < length && alpha != dataArray[index]){ index++; } result = (index < length); }
void List::Mystery( ItemType alpha, bool& result ){ int index = 0; while (index < length && alpha != dataArray[index]){ index++; } result = (index < length); }
Explanation / Answer
FIRST CORRECT ANSWER :