How to convert HEX String to Binary?

Assuming I receive as parameters
"0"~"F", how to convert it to
0000~1111?

Depends on how you want to store the binary: Do you want to store one bit per bit? One bit per byte? One character per byte?

How many hex digits?

Do you want a numeric value to do math on or a binary to display?

Check out strtol().

Are you receiving single characters, or some kind of string ? Do you want to put two 4-bit values into each byte ? It depends exactly what you want to do, but it's not very difficult.