If I create a void pointer, and malloc a section of memory to that void pointer, how can I print out the individual bits that I just allocated?
For example:
size_t size = 24; void *p = malloc(size); for (int i = 0; i < size; i++) { printf("%02x", ((unsigned char *) p) [i]); }
Of course it invokes undefined behavior (the value of an object allocated by malloc has an indeterminate value).
malloc