Bxbigboy7845 Bxbigboy7845
  • 19-07-2019
  • Computers and Technology
contestada

How many base cases are in the functionabove?

a. 0

b. 1

c. 2

d. 3

int func2(int m, int n) {

if (n == 0)

return 0;

else

return m + func2(m, n-1);

}

Respuesta :

ExieFansler ExieFansler
  • 23-07-2019

Answer:

The answer is (b). 1.

Explanation:

In the code there is only 1 base case .

the base case is as following:-

if(n==0)

return 0;

this is the base case.

Base case is the most important statement in the function that uses recursion because without base case the recursion calls will keep on going and we will get a run time error.

Answer Link

Otras preguntas

Which statement is most characteristic of George Washington? He established the custom of using the heads of various departments for his personal advisers. He w
in the 1920s, sacco and vanzetti case, the red scare, and the activities of the klu klux klan all represented
Which is NOT a type of expository text? A. Essay B. Newspaper article C. Poem D. Report
what are the factors for 80
Que son las figuras planas
What term was used to describe roosevelts policies and how accurate was it?
The release of stored energy from rocks that are deformed by stress is called elastic
The law of conservation of mass applies to all chemical reactions.
It takes jeff 1/3 of an hour to walk to the libary 3/4 miles away what is his walking pace
What is the most likely source of the increase in carbon dioxide in the atmosphere