Question: consider the function to search the array and count string matches: int numMatches(string** const A, int Sz, const string& toMatch) { // Line 1 if

consider the function to search the array and count string matches:

int numMatches(string** const A, int Sz, const string& toMatch) { // Line 1

if ( A == NULL || Sz <= 0 )

return 0; // 2

int Count = 0; // 3

for (int Pos = 0; Pos < Sz; Pos++) { // 4

if ( _______ && _______ ) // 5

Count++; // 6

}

return Count; // 7

}

In order to prevent an access violation, how should the first blank in Line 5 be filled?

A)

A != NULL

B)

A[Pos] != NULL

C)

toMatch != ""

D)

None is needed; it should be left blank and the && should be removed.

E)

None of these

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!