#include <stdio.h>
void dump_hex(char* ptr, size_t length)
{
size_t i;
for(i = 0; i < length; ++i)
{
printf("%01x%01x", (ptr
[i
] >> 4) & 0x0F, ptr
[i
] & 0x0F); }
}
int main(void) {
char hoge[] = { 0xde, 0xad, 0xbe, 0xef };
dump_hex(hoge, 4);
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiAKdm9pZCBkdW1wX2hleChjaGFyKiBwdHIsIHNpemVfdCBsZW5ndGgpCnsKICAgIHNpemVfdCBpOwogICAgZm9yKGkgPSAwOyBpIDwgbGVuZ3RoOyArK2kpCiAgICB7CiAgICAgICAgcHJpbnRmKCIlMDF4JTAxeCIsIChwdHJbaV0gPj4gNCkgJiAweDBGLCBwdHJbaV0gJiAweDBGKTsKICAgIH0KfQogCmludCBtYWluKHZvaWQpIHsKCWNoYXIgaG9nZVtdID0geyAweGRlLCAweGFkLCAweGJlLCAweGVmIH07CglkdW1wX2hleChob2dlLCA0KTsKCXJldHVybiAwOwp9