I'm trying to work out what this does:
ptr = input_string;
dest = input_string;
while( *ptr && *ptr != '\r' && *ptr != '\n' ) {
if ( *ptr >= '0' && *ptr <= '9' ) *dest++ = (char) ( (*ptr) - '0' );
if ( *ptr >= 'A' && *ptr <= 'F' ) *dest++ = (char) ( (*ptr) - 'A' + 10 );
if ( *ptr >= 'a' && *ptr <= 'f' ) *dest++ = (char) ( (*ptr) - 'a' + 10 );
ptr++;
}
and
prev_byte = 0;
ptr = input_string;
while ( *ptr != '\x80' ) {
hex_val = (char) ( ( * ptr & '\x0f' ) << 4 );
hex_val |= (char) ( ( *(ptr+1) & '\x0f' ) );
crc_kermit = update_crc_kermit( crc_kermit, hex_val );
prev_byte = hex_val;
ptr += 2;
}
I've read a dew tutorials and such on pointers, but though I sort of understand what the output looks like, I don't understand how it works.
I'm trying to do a java port and want to know what is going on.