My mistake with the code above (double quotes). In my actual program I am sending a single char (e.g. HexValue(str[0])). It works fine however I figure I might be going about it the hard way. Regarding PRINTF() ... If I use the %d format specifier then it displays the ASCII decimal value (e.g. 'A' = 97) and if I use the %X it displays the ASCII hexadecimal value (e.g. '7' = 37). I don't want that. I need to do math calcs so I need the actual integer so that 'A' is 10 and 'F' is 15 and '7' is 7, etc. So I ask again is my HexValue() function a bad solution??