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
What does volatile do?
How will you write a code for accessing the length of an array without assigning it to another variable?
Write a C program linear.c that creates a sequence of
processes with a given length. By
sequence it is meant that each created process has exactly
one child.
Let's look at some example outputs for the program.
Here the entire process sequence consists of process 18181:
Sara@dell:~/OSSS$ ./linear 1
Creating process sequence of length 1.
18181 begins the sequence.
An example for a sequence of length three:
Sara@dell:~/OSSS$ ./linear 3
Creating process sequence of length 3.
18233 begins the sequence.
18234 is child of 18233
18235 is child of 18234
........ this is coad .... BUt i could not compleate it .....:(
#include
please give me a VIRTUSA sample palcement papers.... you will only send TECHNICAL SECTION..... that is help for me Advance Thanks........................
What is file in c preprocessor?
How can I access an I o board directly?
How do you use a pointer to a function?
how to print the character with maximum occurence and print that number of occurence too in a string given ?
Explain what is wrong with this program statement? Void = 10;
What is a stream water?
main() { int i = 10; printf(" %d %d %d ", ++i, i++, ++i); }
Is c weakly typed?
How can I determine whether a machines byte order is big-endian or little-endian?
Describe the difference between = and == symbols in c programming?
What is the sizeof () operator?