Consider the following ANSI-C function.
The maximum possible value that can be returned from this function is ________. (answer in integer)
Note: Ignore syntax errors (if any) in the function.
c
Programming in CFunctions, Parameter Passing, Scope Rules, RecursionNAT2 marksHard
1int func(int start, int end){
2 int length = end + 1 - start;
3 if((length<1) || (start < 0) || (end<0)){ return(0); }
4 if(length%3 == 0){
5 return(func(start+1, end));
6 } else if(length%3 == 1){
7 return(1 + func(start, end -1));
8 } else {
9 return(func(start + 2, end));
10 }
11}
12A GATE question every morning
One real past-paper question every morning for your branch, answer hidden until you tap. Free on Telegram.