• edited by
2,167 views
2 2 votes
Consider the following C code:
include <stdio.h>
int fun()
{
static int num=25;
return num--;
}
int main()
{
for(fun( ); fun();fun())
printf("%d", fun( ));
return O;
}
The sum of the values printed by the above program will be

 

1 Answer

1 1 vote
It won't do anything , it will have compilation error.

Used : instead of ;

If we consider it without errors , equivalent while loop can be written as :-

fun(); //initialization

while(fun()//termination condition when fun() gets 0) {

print("%d",fun());

fun();

}

which will print :-

2320171411852
Position:
Show:

Related questions

2 2 votes
0 0 answers
1.3k
1.3k views
srestha asked Jan 28, 2019
1,348 views
void foo(int n) { for(i1=1;i1<=n;i1++) { for(i2=1;i2<=i1;i2++) { ....... { for(i6=1;i6<=i5;i6++) { count++; } } } } }Count initially 0.What is value returned by foo(8)?
0 0 votes
1 1 answer
882
882 views
Markzuck asked Jan 10, 2019
882 views
Please explained detialed execution of this code, I am not getting how int stored in char, like we can interchange using ASCII but still cant store right?
3 3 votes
2 answers 2 answers
1.0k
1.0k views
Shamim Ahmed asked Dec 11, 2018
1,003 views
char *a = “MADEEASY”;char *b = “GATECSIT2019”;char *r = a;char *s = b;printf(“%d”, (int) strlen (b+3[r] – 1[s]));return 0; Whats the output? Answer given 8
2 2 votes
2 2 answers
1.7k
1.7k views
Shamim Ahmed asked Dec 11, 2018
1,656 views
main(){ int S[6] = {126,256,512,1024,2048,4096}; int *x=(int *) (&S+1); printf (“%d”,x); }int is 4 bytes; array starts from 2000 .The answer is 2024 I am getting 2004.Ple...