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

How can I convert a number to a string?

1250


Tell me when would you use a pointer to a function?

1121


Read the following data in two different files File A: aaaaaaaadddddddd bbbbbbbbeeeeeeee ccccccccffffffff File B: 11111111 22222222 33333333 By using the above files print the following output or write it in the Other file as follows aaaaaaaa11111111dddddddd bbbbbbbb22222222eeeeeeee cccccccc33333333ffffffffffff

3394


Differentiate fundamental data types and derived data types in C.

1089


What are operators in c?

1077


any restrictions have on the number of 'return' statements that may be present in a function. a) no restriction b) only 2 return statements c) only 1 return statements d) none of the above

1198


How will you delete a node in DLL?

1338


any limit on the number of functions that might be present in a C program a) max 35 functions b) max 50 functions c) no limit d) none of the above

1101


What functions are used in dynamic memory allocation in c?

1119


Can you please compare array with pointer?

1153


What is the difference between scanf and fscanf?

1342


Explain which of the following operators is incorrect and why? ( >=, <=, <>, ==)

1087


What is calloc() function?

1162


Which node is more powerful and can handle local information processing or graphics processing?

1370


how to print the character with maximum occurence and print that number of occurence too in a string given ?

2530