logic - What is wrong in this C code ? If its a logical error please suggest the right way -
logic - What is wrong in this C code ? If its a logical error please suggest the right way -
int i; for(i=7;i<6;i--)//loop not execute { printf("*"); }
the above code should print 1 * nothing. shouldn'tit run same for(i=7;i<8;i++) ?
is logical error ? please help.
let's @ loop
for( = 7 ; < 6 ; i-- )
i
initialized 7
, have status i < 6
, i
7
, , therefor, not satisfy status of loop. so, code not go through 1 iteration of loop.
maybe, meant i > 6
c logic
Comments
Post a Comment