On Tue, Nov 30, 1999 at 02:17:06PM -0700, Dwayne Reid wrote: > This is the challenge: how to tell which number is highest. The records Just subtract one from the other, and look at the result only (not the carry flag). E.g. if you have two adjacent numbers 7 and 8, subtract 7 from 8, you get 1. So 8 is higher. Similarly, if you subtract FF from 0, you get 1, so 0 is higher. unsigned char buffer[BLEN]; unsigned char i, j; for(i = 0 ; i != BLEN-1 ; i++) { j = buffer[i+1]-buffer[i]; if(j != 1) break; } /* now i points to the most recent entry in the buffer */ This will also give a sensible result if the buffer is all zeros. Regards, Clyde -- Clyde Smith-Stubbs | HI-TECH Software Email: clyde@htsoft.com | Phone Fax WWW: http://www.htsoft.com/ | USA: (408) 490 2885 (408) 490 2885 PGP: finger clyde@htsoft.com | AUS: +61 7 3355 8333 +61 7 3355 8334 --------------------------------------------------------------------------- HI-TECH C: compiling the real world.