Search code examples
cchar

How to print a unsigned char to a human readable format in c?


I would like to print the unsigned char in this format: 0xff. How can I do so? Thanks.


Solution

  • printf("0x%x\n", variable);
    

    Visit printf documentation page for more details