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 TO SOLVE A NUMERICAL OF LRU IN OS ??????

2698


write a c program in such a way that if we enter the today date the output should be next day's date.

2197


What is size of union in c?

1028


C program to find all possible outcomes of a dice?

2365


Are there namespaces in c?

1133


How would you obtain the current time and difference between two times?

1295


Differentiate between calloc and malloc.

1275


How can I use a preprocessorif expression to ?

1065


What do you mean by c what are the main characteristics of c language?

1037


What is the difference between a function and a method in c?

1087


What are preprocessor directives in c?

1102


pgm to find any error in linklist(in single linklist check whether any node points any of previous nodes instead of next node)

2646


Program to find the sum of digits of a given number until the sum becomes a single digit. (e.g. 12345=>1+2+3+4+5=15=>1+5=6)

1159


What is define c?

1082


What is a char c?

1043