How do i return a string of hex in C? : I have a cryptographic program in which i need to represent each character by its hex value and return all of these hex value as a char string. After multiple crypto functions i got a final decimal value of each char. Now at the end of a for cycle i need to put all of them in a string containing each character hex value separated by space. In short, i have decimal number, which i need to convert to hex and put them in a string for return. Thanks for responses. I tried sprintf but i obviously cant put it into char string because it can only hold one char per index.