??? 02/10/09 16:53 Read: times |
#162252 - Local variables within inner blocks Responding to: ???'s previous message |
Kiran V. Sutar said:
2. You have defined parameters inside the function and after using the commands...remember Keil is C ..NOT C++. So define them at the begining of th function..example of your mistake: Note that 'C' does permit you to define variables within inner blocks; eg, void function( void ) { int loop_words; // this variable is local to the function for( loop_words=0; loop_words<3; loop_words++ ) { int local_var; // this variable is local to the block formed by the 'for' } } In principle this might be advantageous in giving the compiler more scope for overlaying; in practice, I don't think Keil C51 takes advantage of this. :-( |