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
HOW TO SOLVE A NUMERICAL OF LRU IN OS ??????
write a c program in such a way that if we enter the today date the output should be next day's date.
What is size of union in c?
C program to find all possible outcomes of a dice?
Are there namespaces in c?
How would you obtain the current time and difference between two times?
Differentiate between calloc and malloc.
How can I use a preprocessorif expression to ?
What do you mean by c what are the main characteristics of c language?
What is the difference between a function and a method in c?
What are preprocessor directives in c?
pgm to find any error in linklist(in single linklist check whether any node points any of previous nodes instead of next node)
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)
What is define c?
What is a char c?