Hi Alex, > I define an array inside a function. > Unfortunately, all the elements of the array initialized by 0x30, > instead of the given values. > > unsigned char conversion_by_table(unsigned char index) > { > unsigned char conversion_table[4] ={'0x01','0x02','0x03','0x04'}; > return conversion_table[index & 0x03]; > }
You want unsigned char conversion_table[4] = {0x01, 0x02, 0x03, 0x04}; or char * conversion_by_table(unsigned char index) { char conv[4] = { "0x01", "0x02", "0x03", "0x04" }; return (conv[index & 0x03]); } 0x30 is the ASCII code of the character '0'... Regards, Raphael ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Sdcc-user mailing list Sdcc-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sdcc-user