I have a simple question. The code is really short so I just post it here
#include int main(int argc, const char * argv[]) { long int p;
First convert to unsigned:
unsigned char q = *(unsigned char *)(p); printf("%02X", q);
(Otherwise, if your char is signed, the variadic default promotion converts the value to int, and the result may be negative.)
char
int