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

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -