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
explain what is an endless loop?
What are categories used for in c?
Describe wild pointers in c?
Why is c so important?
What is signed and unsigned?
is it possible to create your own header files?
Why is c so powerful?
How many header files are in c?
What is the difference between array and pointer?
What are the salient features of c languages?
Explain the difference between structs and unions in c?
What is an auto variable in c?
Is it fine to write void main () or main () in c?
Can you write a programmer for FACTORIAL using recursion?
What is array in c with example?