what will be the output of the following program, justify?
#define TEST
int TEST getdata()
{
static i;
i+=10;
return i;
}
main()
{
int k;
k = getdata();
}
Answer Posted / rkr
The Static variable is initialized to zero
In the above program
static i; which is equivalent to static i = 0;
Next line i is incrementing by 10, then i value is 10.
return the value is 10
| Is This Answer Correct ? | 1 Yes | 2 No |
Post New Answer View All Answers
What are global variables?
Why is event driven programming or procedural programming, better within specific scenario?
How can I find out the size of a file, prior to reading it in?
write a programming in c to find the sum of all elements in an array through function.
Why is struct padding needed?
can we have joblib in a proc ?
What is the difference between far and near in c?
Why static variable is used in c?
Explain what is the benefit of using const for declaring constants?
Write a code to achieve inter processor communication (mutual exclusion implementation pseudo code)?
What is getch() function?
Explain how can you determine the size of an allocated portion of memory?
What is array in c with example?
What are the __date__ and __time__ preprocessor commands?
Explain is it valid to address one element beyond the end of an array?