really got stuck with unsigned chars

This is a discussion on really got stuck with unsigned chars within the C Programming forums, part of the General Programming Boards category; Hi,
I have program that converts 16 hex chars to 8-ascii characters
while testing, i have noted that the program ...

really got stuck with unsigned chars

Hi,
I have program that converts 16 hex chars to 8-ascii characters
while testing, i have noted that the program generates a large unsigned chars figures such 266,239, 160...
How can I get the corresoonding ascii characters from above unsigned chars ?
here is the snippet:

In the function you are increasing the pointer. This is dangerous, better would be to have a local pointer in the function, called X_ptr or something, which points to the elements of the array. Or just use the indices of the array.

--

It seems you're having two hexadecimal values, like 0x05 and 0x06, which you want to combine into one ASCII character. 0x05 and 0x06 are between 0 and 9, so you add them to 16*5+6 = 86.
And that value is returned.

I do not really understand the purpose of the function. Can you give an example input with the correct output?

the corresponding characters are 0
the corresponding characters are 1
the corresponding characters are 2
the corresponding characters are 3
the corresponding characters are F
the corresponding characters are G
the corresponding characters are H
the corresponding characters are I

shiro you said use a local pointer X_ptr , I don't get what you mean ?