c - How to print binary content of bytes pointed by a pointer? -
this question has answer here:
i have pointer returned malloc. points first byte of allocated size. ex:
void* p=malloc(34);
how print binary values contained in 34 bytes. ?
you want :
int ; void* p=malloc(34); (i = 0; < 34; i++) { unsigned char c = ((char*)p)[i] ; printf ("%02x ", c) ; }
it doesn't print in binary (010011011) in hexadecimal, that's want.
but stated in comments garbage values.
Comments
Post a Comment