Consider the following C functions:
The value returned by
c
pp(3,4) is ________.Programming in CFunctions, Parameter Passing, Scope Rules, RecursionNAT2 marksHard
1int tob(int b, int* arr) {
2 int i;
3 for(i=0; b>0; i++) {
4 if(b%2) arr[i]=1;
5 else arr[i]=0;
6 b=b/2;
7 }
8 return(i);
9}
10int pp(int a, int b) {
11 int arr[20];
12 int i, tot=1, ex, len;
13 ex=a;
14 len=tob(b,arr);
15 for(i=0; i<len; i++) {
16 if(arr[i]==1)
17 tot=tot * ex;
18 ex = ex * ex;
19 }
20 return(tot);
21}
22pp(3,4) is ________.A GATE question every morning
One real past-paper question every morning for your branch, answer hidden until you tap. Free on Telegram.