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 / ashwin kumar
hi Gg
answer is 0 1 2 5 10
this not stack prlm dear
here printf is after the function call dear so it is
printing 0 1 2 5 10
if u wnt to see 10 5 2 1 0 as output plz keep printf
function before function call that is
fun(int x)
{
if(x > 0)
printf("%d\n", x);
fun(x/2);
}
but output will be 10 5 2 1 only on 0 is printed
this above new code will give segmentation error in netbeans
thank u dear
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
In C language what is a 'dangling pointer'?
What is extern variable in c with example?
Can a file other than a .h file be included with #include?
What are external variables in c?
What is #include conio h?
What is indirection in c?
Explain logical errors? Compare with syntax errors.
Which is the best website to learn c programming?
Which is the memory area not included in C program? give the reason
Explain what is wrong with this program statement?
Explain how do you sort filenames in a directory?
Can we assign integer value to char in c?
Write a c program to build a heap method using Pointer to function and pointer to structure ?
What is the process of writing the null pointer?
Can we assign string to char pointer?