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

consider the following C code
main()
{
int i=3,x;
while(i>0)
{
x=func(i);
i--;
}
int func(int n)
{
static sum=0;
sum=sum+n;
return(sum);
}
the final value of x is

Answer Posted / naksh @tcs

Answer is 6;

Sum being the static variale will retain its value state
between he function calls.

Is This Answer Correct ?    17 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

explain what is an endless loop?

1147


What are categories used for in c?

1151


Describe wild pointers in c?

1166


Why is c so important?

1101


What is signed and unsigned?

1122


is it possible to create your own header files?

1164


Why is c so powerful?

1163


How many header files are in c?

1065


What is the difference between array and pointer?

1083


What are the salient features of c languages?

1138


Explain the difference between structs and unions in c?

1067


What is an auto variable in c?

1294


Is it fine to write void main () or main () in c?

1076


Can you write a programmer for FACTORIAL using recursion?

1100


What is array in c with example?

1356