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

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -