Given the following function definition, what modifications need to be made to the search function so that it finds all occurrences of target in the array?
Int searchconst int array[], int target, int numElements)
{
Int index=0;
Bool found=false;
While!found) && index < numElements) )
{
Ifarray[index] == target)
Found=true;
Else
Index++;
}
Iffound==true)
Return index;
Else
Return -1;
}
A) Add another parameter to indicate where to stop searching
B) Add another parameter to indicate where to start searching
C) This already can find all occurrences of a given target
D) Have the function return the whole array
Correct Answer:
Verified
Q25: In the expression
double score[10];
double is called the
Q26: Given an array of integers of size
Q27: Given the following function definition for a
Q28: In the expression
cout << score[i] << endl;
i
Q29: An _ is used to process a
Q31: Which of the following function declarations correctly
Q32: Given an array named scores with 25
Q33: Arrays are always passed to a function
Q34: Indexes are numbered starting at _
Q35: Which of the following function declarations could
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents