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();
}
Answers were Sorted based on User's Feedback
Answer / rama krishna sidhartha
Since there is no output statement in this program there
output will not be displayed.
The output statement must be as follows :
printf("%d",k);
Then the output will be 10.
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / aditya
there is no print statement and hence there is no output.
If at all k is printed it will be 10.
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / 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 |
When should a far pointer be used?
why in C,C++'s int size is 2 byte and .net(c#) int Size is 4 byte?
How does variable declaration affect memory?
WAP to accept rollno,course name & marks of a student & display grade if total marks is above 200?
WRITE A PROGRAM IN C TO MULTIPLY TWO 2-D ARRAYS
How to calculate sum
What is Function Pointer? Explain with example?
Is anything faster than c?
Why we use void main in c?
What is the difference between memcpy and memmove?
Why main is used in c?
What is the purpose of the statement: strcat (S2, S1)?