I wanted to inspect the address of my variable
volatile int clock; cout << &clock;
But it always says that x is at address 1. Am i doing something wrong??
iostreams will cast most pointers to void * for display - but no conversion exists for volatile pointers. As such C++ falls back to the implicit cast to bool. Cast to void* explicitly if you want to print the address:
void *
volatile
bool
void*
std::cout << (void*)&clock;
2.1m questions
2.1m answers
60 comments
57.0k users