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:
You can't - reading those bytes before initializing their contents leads to undefined behavior. If you really insist on doing this, however, try this:
void *buf = malloc(24); unsigned char *ptr = buf; for (int i = 0; i < 24; i++) { printf("%02x ", (int)ptr[i]); } free(buf); printf("\n");