Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

In C language what is a 'dangling pointer'?

1060


What is extern variable in c with example?

946


Can a file other than a .h file be included with #include?

1097


What are external variables in c?

1034


What is #include conio h?

939


What is indirection in c?

1018


Explain logical errors? Compare with syntax errors.

1008


Which is the best website to learn c programming?

1025


Which is the memory area not included in C program? give the reason

1896


Explain what is wrong with this program statement?

1065


Explain how do you sort filenames in a directory?

979


Can we assign integer value to char in c?

1153


Write a c program to build a heap method using Pointer to function and pointer to structure ?

4620


What is the process of writing the null pointer?

979


Can we assign string to char pointer?

1040