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 / gg

0 1 2 5 10 is the answer. But can anybody explain why the
printing order 0 1 2 5 10. Why not 10 5 2 1 0 ? please...

Is it depends on stack allocation??

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is c value paradox explain?

563


When should a type cast be used?

569


write a C program: To recognize date of any format even formats like "feb-02-2003","02-february-2003",mm/dd/yy, dd/mm/yy and display it as mm/dd/yy.

3329


Why isn't it being handled properly?

632


4. main() { int c=- -2; printf("c=%d",c); }

1360






write a program that types this pattern: 12345678987654321 12345678 87654321 1234567 7654321 123456 654321 12345 54321 1234 4321 123 321 12 21 1 1

3244


Write a C program on Centralized OLTP, Decentralized OLTP using locking mechanism, Semaphore using locking mechanism, Shared memory, message queues, channel of communication, sockets and a simple program on Saving bank application program using OLTP in IPC?

2161


What is meant by errors and debugging?

637


What is far pointer in c?

797


Which is not valid in C a) class aClass{public:int x;}; b) /* A comment */ c) char x=12;

601


What is a pointer on a pointer in c programming language?

607


Explain logical errors? Compare with syntax errors.

615


List at least 10 sorting methods indicating their average case complexity, worst case complexity and best case complexity.

2294


find the sum of two matrices and WAP for it.

620


In C programming, what command or code can be used to determine if a number of odd or even?

611