Consider the following C program:
The output of this program is _____.
c
Programming in CFunctions, Parameter Passing, Scope Rules, RecursionNAT1 markMedium
1#include <stdio.h>
2
3int counter = 0;
4
5int calc (int a, int b) {
6 int c;
7 counter++;
8 if (b==3) return (a*a*a);
9 else {
10 c = calc(a, b/3);
11 return (c*c*c);
12 }
13}
14
15int main (){
16 calc(4, 81);
17 printf ("%d", counter);
18}
19A GATE question every morning
One real past-paper question every morning for your branch, answer hidden until you tap. Free on Telegram.