Computer Sciences > Gate 2017 Set-1 > C Programming
Consider the C functions foo and bar given below:
Invocations of foo(3) and bar(3) will result in:
int foo(int val)
{
int x = 0;
while (val > 0)
{
x = x + foo(val--);
}
return val;
}
int bar(int val)
{
int x = 0;
while (val > 0)
{
x = x + bar(val-1);
return val;
}
}
{
int x = 0;
while (val > 0)
{
x = x + foo(val--);
}
return val;
}
int bar(int val)
{
int x = 0;
while (val > 0)
{
x = x + bar(val-1);
return val;
}
}
Invocations of foo(3) and bar(3) will result in:
Correct : C Programming
Similar Questions
Consider the following two functions
void fun1(int n){
if(n == 0) return;
printf(β%dβ, n);
fun2(n-2);
&...
What is printed by the following ANSI C program?
#include<stdio.h>
int main(int argc, char *argv[])
{
int a[3][3][3] =
{{...
Consider the following C program:
#include<stdio.h>
int main() {
int a[] = {2, 4, 6, 8, 10};
int i, sum = 0, *b = a + 4;
&...
Total Unique Visitors
Loading......