fun(int x)
{
if(x > 0)
fun(x/2);
printf("%d", x);
}
above function is called as:
fun(10);
what will it print?
}
Answer Posted / mahesh patil
Only answer 1
answer 4
answer 7 are correct others are wrong..
If you are confident on your answers please check once then
write a post.
Correct Answer: 0 1 2 5 10
This will print in reverse order because, This is a
recursive call, Every time a function is called the values
are stored in stack/stack is created. when x value reaches
0 then it will return. So stack is LIFO order, So it will
print the values in reverse order.
Is This Answer Correct ? | 9 Yes | 0 No |
Post New Answer View All Answers
Discuss the function of conditional operator, size of operator and comma operator with examples.
Can we change the value of static variable in c?
Explain what would happen to x in this expression: x += 15; (assuming the value of x is 5)
What are variables and it what way is it different from constants?
what will be the output for the following main() { printf("hi" "hello"); }
What is .obj file in c?
typedef struct{ char *; nodeptr next; } * nodeptr ; What does nodeptr stand for?
How do you write a program which produces its own source code as output?
Explain how can you be sure that a program follows the ansi c standard?
to find the closest pair
how to execute a program using if else condition and the output should enter number and the number is odd only...
Do you know pointer in c?
Is c call by value?
Can you please explain the scope of static variables?
Explain what is a 'null pointer assignment' error? Explain what are bus errors, memory faults, and core dumps?