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

Hi all,

since the code is calling the same function with different
values,it's not at all possible to move to printf statement
until x becomes < 0

so only when the compiler gets the value of x as 0 the loop
will be stopped.

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is wrong with this statement? Myname = 'robin';

822


If null and 0 are equivalent as null pointer constants, which should I use?

580


What is the difference between array and pointer?

569


Are there any problems with performing mathematical operations on different variable types?

575


How can you allocate arrays or structures bigger than 64K?

683






write a c program to find the largest and 2nd largest numbers from the given n numbers without using arrays

1785


Differentiate call by value and call by reference?

569


What are different types of variables in c?

571


What is an expression?

658


main() { struct s1 { char *str; struct s1 *ptr; }; static struct s1 arr[] = { {"Hyderabad",arr+1}, {"Bangalore",arr+2}, {"Delhi",arr} }; struct s1 *p[3]; int i; < BR> for(i=0;i<=2;i++) p[i] = arr[i].ptr; printf("%s ",(*p)->str); printf("%s ",(++*p)->str); printf("%s ",((*p)++)->str); }

920


i got 75% in all semester am i eligible for your company

1739


What is %s and %d in c?

594


What is data structure in c programming?

574


Why c is a procedural language?

584


What does *p++ do? What does it point to?

616