unsigned char *teta = ....;
...
printf(\"data at %p\\n\", teta); // prints 0xXXXXXXXX
How can I print variable address using iostreams
Cast to void*:
unsigned char* teta = ....;
std::cout << "data at " << static_cast(teta) << "\n";
iostreams generally assume you have a string with any char* pointer, but a void* pointer is just that - an address (simplified), so the iostreams can't do anything other than transforming that address into a string, and not the content of that address.