# Thread: Emulating Constants w/ Individual Characters

1. ## Emulating Constants w/ Individual Characters

You say that title doesn't make sense? What? Oh, okay, I'll explain...

In printf(), you can print a character by feeding it a hexidecimal number, as follows:

Code:
`printf("%c", 0x61);`
This would produce the character a. Now, the complicated part. How would I emulate that hex constant if I had the first digit in one character, and the second in another character? Do I need to actively convert from the hex to decimal and feed that to the character? I'm perfectly able to do that conversion, I'm just using this as a learning experience.

Thanks for any light you may be able to shed on the subject.
-Aaron

2. Originally Posted by daltore
How would I emulate that hex constant if I had the first digit in one character, and the second in another character?
Convert the hex digits to their corresponding int values (as in '0' to 0, 'A' to 10, etc). Now, you can compute your desired result by doing an 16 * a + b, where a and b are the int variables.