+ 2

What is the output , code is in C ?

int main() { int i,j,s; i=0; j=(0,23); A: printf ("%d\n",i+=5); printf ("%d\n",i-=7); if (i<=5&&i>=-5) goto A; s=((i!=j)&&(j)); printf ("%d\n",s); return 0; }

26th Oct 2017, 6:20 PM
Deepesh Pandey
Deepesh Pandey - avatar
2 odpowiedzi
+ 2
Yes @Daniel, ',' operator execute all statements but return the result of the last one, here 23 Output : 5 -2 3 -4 1 -6 1 // j == 23 which is different from -6, so s is 1
28th Oct 2017, 1:42 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
0
j is an int?:-0
26th Oct 2017, 10:11 PM
Daniel
Daniel - avatar