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
we called a function and passed something do it we have always passed the "values" of variables to the called function. such functions calles are called a) calls by reference b) calls by value c) calls by zero d) none of the above
#include
What is binary tree in c?
what is a NULL Pointer? Whether it is same as an uninitialized pointer?
How can I read data from data files with particular formats?
What are the disadvantages of a shell structure?
The postoder traversal is 7,14,3,55,22,5,17 Then ur Inorder traversal is??? please help me on this
Explain how can you tell whether two strings are the same?
What is break statement?
WRITE A PROGRAM TO MERGE TWO SORTED ARRAY USING MERGE SORT TECHNIQUE..
Here is a good puzzle: how do you write a program which produces its own source code as output?
what is recursion in C
a formula,a series of steps,or well defined set of rules for solving a problem a) algorithem b) program c) erdiagram d) compiler
Why c is faster than c++?
How can I automatically locate a programs configuration files in the same directory as the executable?