??? 10/22/10 06:49 Modified: 10/22/10 08:55 Read: times |
#179261 - for( expression-1; expression-2; expression-3 ) [ed] Responding to: ???'s previous message |
Justin Fontes said:
It's really not that strange i is instantiated as 0x01 No, i is not instanciated - that means, "to create an instance of" In 'C' (unlike C++), i must already exist before it can be used; ie, it must already have been "instanciated" (although that is not really a term used by 'C'). The term is "initialised" - or, in fact, just "set to 1" would do! the for loop never compares A for loop always take the value of the 2nd expression as the condition on whether to exit or continue the loop: if the value of the 2nd expression is zero, the loop exits; otherwise, it continues. Note: The above paragraph has been corrected to say "2nd" (it was initially wrong and said "3rd") - see: http://www.8052.com/forum/read/179267 There doesn't need to be a explicit comparison here! last I checked I did not think i was a condition. Well, it's not a condition as such - it's just a value, and the decision is based on whether that value is zero or non-aero. The same applies in if() clauses, and anywhere else that 'C' makes a true/false decision. eg, the common while( 1 ); // loop forever or, similarly #if 0 // this code is disabled : : #endif I do not have enough eyes to see what you're doing with your i's! Very good - I like that one! |