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

How do I use strcmp?

1024


What is the best way to comment out a section of code that contains comments?

1264


Explain that why C is procedural?

1082


What is the difference between new and malloc functions?

1052


Input is "rama loves rajesh and rajesh Loves rama also and rajesh wear gloves and bloves" To print output is count the numbers of times repeted the word love without case sensitive.

2010


Why is not a pointer null after calling free? How unsafe is it to use (assign, compare) a pointer value after it is been freed?

1047


When should I declare a function?

1055


can we have joblib in a proc ?

2231


What is the difference between int main and void main?

999


What do you mean by dynamic memory allocation in c? What functions are used?

1107


How can I read/write structures from/to data files?

924


What does the c in ctime mean?

1018


What does *p++ do?

979


Why doesn't C support function overloading?

2611


Function which gives a pointer to a binary trees const an integer value at each code, return function of all the nodes in binary tree.?

1014