exactly.. this was the reason why the code appeared wierd alok > -----Original Message----- > From: Stephen B Webb [SMTP:sbwebb0@SAC.UKY.EDU] > Sent: Friday, January 26, 2001 8:39 PM > To: PICLIST@MITVMA.MIT.EDU > Subject: Re: [OT]: quick question on C > > > i came across the following 'for' statement in a code: > > > > for (pass=rx_str[ptr1+1]; ptr1 > > > i'm curious about about the 'ptr1 > have never come across a for loop layed out in this way. > > 1. is this valid? > > Yes, it is valid. It is unclear code, and I'm not sure that it does what > the author wanted it to do. > > > 2. if so, is it the same as saying 'ptr1 > No, it's the same as saying > > (ptr1 > > The reason I was suggesting that it may not do what the author intended is > because the first statement: > > pass=rx_str[ptr1+1] gets evaluated exactly one time, so pass does not get > updated each loop iteration. Unless pass is updated in the loop body, or > the programmer intended to only test the 'firsrt' value of pass, then the > code is probably broken. > > -Steve > > -- > http://www.piclist.com hint: To leave the PICList > mailto:piclist-unsubscribe-request@mitvma.mit.edu > -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads