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...

What is the output of below code?
main()
{
static in a=5;
printf("%3d",a--);
if(a)
main();
}

Answer Posted / pratik panchal

output:5 4 3 2 1

static int store the value of variable for once and
periodically changes its value as the variable value changes
and a-- is done so the assigned value on the next line will
automatically overwrite the value of a.

%3d means print 5 then 2 spaces and 4 and so on..,.main is
called until if statement gets false..if(5) is a true
condition.

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 d'n in c?

1127


explain what is an endless loop?

1105


Can we add pointers together?

1068


How can I rethow can I return a sequence of random numbers which dont repeat at all?

1194


What is string concatenation in c?

1097


Explain how do you convert strings to numbers in c?

1085


Is malloc memset faster than calloc?

1083


What are structures and unions? State differencves between them.

1189


Write a code to determine the total number of stops an elevator would take to serve N number of people.

1270


What is sizeof in c?

1015


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

2482


Explain setjmp()?

1079


What is a char in c?

1003


I came across some code that puts a (void) cast before each call to printf. Why?

1227


Explain a file operation in C with an example.

1127