1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Blizzard [7]
3 years ago
7

Given the following function definition, what modifications need to be made to the search function so that it finds all occurren

ces of target in the array?int search(const int array[], int target, int numElements){int index=0;bool found=false;while((!found) && (index < numElements)){if(array[index] == target)found=true;elseindex++;}if(found==true)return index;elsereturn -1;}a. Add another parameter to indicate where to stop searchingb. Add another parameter to indicate where to start searchingc. This already can find all occurrences of a given targetd. Have the function return the whole array
Computers and Technology
1 answer:
svet-max [94.6K]3 years ago
8 0

Answer:

D. have function return the whole array

Explanation:

the given function only return first occurrence of target. In order to get all occurrences of target we have to change condition in while loop to check whole array even if first occurrence of target found and plus add another parameter of type array that will store different  indexes of occurrence of target and return that array

You might be interested in
What types of roles are there as a webmaster?
Nuetrik [128]
<span> PHP, ASP, and Javascript. They handle the technical aspects </span>
6 0
3 years ago
Read 2 more answers
Focusing on a target market makes it harder to develop products and services that specific groups of customers want.
Sloan [31]

Answer:

ikr so true

Explanation:

5 0
2 years ago
Write a java program as follows Write a method called powOfTwo that takes an integer as parameter, computes, and outputs it’s sq
Kisachek [45]

Answer:

public static int powOfTwo(int input) {

 return input*input;

}

You will have to call this method in main
for printing it, write

System.out.println(powOfTwo(your number));

in public static void main(str[]args) {

}

8 0
1 year ago
How many pounds must a sand bag weigh to test if a safety net can absorb the proper amount of force? A. 150 lbs. B. 200 lbs. C.
Ymorist [56]
C. is your answer have a nice day
7 0
2 years ago
Read 2 more answers
Though there are no specific federal laws for cyberbullying, in some cases cyberbullying
inessss [21]
Cyberbullying overlaps with discriminatory harassment
7 0
2 years ago
Other questions:
  • You are writing a program that defines a variable within a loop, and then tries to use that variable outside the loop. However,
    9·1 answer
  • What does rwd stand for?
    8·2 answers
  • You are configuring IP settings on a new network. For the external interfaces, you decide to obtain registered IP addresses from
    5·1 answer
  • When using a search engine, what is the name of a word or phrase somebody types to find something online?
    12·2 answers
  • Andy is trying to put together a holiday gift knapsack (with W=8) for Sarah. He has n items to choose from, each with infinitely
    15·1 answer
  • If your database is in archivelog mode, how can you force an archive?
    7·1 answer
  • Weak Induction
    8·1 answer
  • Why might you receive a tax refund from the irs
    6·1 answer
  • I need a solution for this problem asap.
    7·1 answer
  • Design algorithm and the corresponding flow chart for adding the subject score of 5, total value and rank.​
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!