Can you explain please | SoloLearn: Learn to code for FREE!

0

Can you explain please

#include <stdio.h> int r(){ static int num=7; return num--; } int main(){ for (r();r();r()) printf("%d",r()); return 0; }

1/20/2021 5:25:43 PM

Lina Godbole

1 Answer

New Answer

+2

I marked the for loop as follow: for(r1() ; r2() ; r3()) printf("%d", r4()) The loop goes like this: r1() 7->6 r2() 6->5 r4() 5->4 //printed 5 r3() 4->3 r2() 3->2 r4() 2->1 //printed 2 r3() 1->0 r2() 0-> -1 // 0 is false. Loop ends.