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

Popular posts from this blog

python - How to add an model instance to a django queryset? -

Using Android Volley to post an array to PHP -

angularjs - No 'Access-Control-Allow-Origin' error from local domain to public API -