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 |
Write a C program to fill a rectangle using window scrolling
What is New modifiers?
Why header file is used in c?
Explain union.
what's the o/p int main(int n, char *argv[]) { char *s= *++argv; puts(s); exit(0); }
Write a program for print infinite numbers
what does ‘#include’ mean?
for example user gives input as " 20 or 20.0 or rs 20.0 or 20.00 or rs20 and so .. on " and the output should be stored as " rs.20.00 " in a variable
how to add our own function in c library please give details.?
Why flag is used in c?
can we initialize all the members of union?
if a is an integer variable, a=5/2; will return a value a) 2.5 b) 3 c) 2 d) 0