Consider the following recursive function: int func (int arg) { if (arg % 2 != 0) return func(arg - 1); if (arg return 1; return func(arg/2) + 1; } a. Is there a value of arg that causes an infinite...


Consider the following recursive function:


int func (int arg)


{


if (arg % 2 != 0)


return func(arg - 1);


if (arg


return 1;


return func(arg/2) + 1;


}


a. Is there a value of arg that causes an infinite recursion? If so, what


is it?


b. Suppose that the function func is part of a program whose main


function is as follows. How many function calls are made to func


when the program is executed?


int main(void)


{


printf("The value is %d\n", func(10));


}


c. What value is output by the program?



May 19, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here