I\'ve got an array of 8 bytes that I\'m trying to print out the hexadecimal notation for. Using printf(\"%x\", array) I can get at the first byte and print it
printf(\"%x\", array)
This is what I did, its a little bit easier with a function and I use for debugging and logging memory.
void print_hex_memory(void *mem) { int i; unsigned char *p = (unsigned char *)mem; for (i=0;i<128;i++) { printf("0x%02x ", p[i]); if ((i%16==0) && i) printf("\n"); } printf("\n"); }