#include <assert.h>
#include <iostream>
#include <iomanip>
char array[10] = "012345678";
int main()
{
for (int i = 0; i < 10; ++i) {
std::cout << std::hex;
std::cout << "&array[i]=0x" << reinterpret_cast<int>(&array[i]) <<
" (array+i)=0x" << reinterpret_cast<int>(array+i) <<
" array[i]=0x" << static_cast<int>(array[i]) << '\n',
std::cout << std::dec;
}
return (0);
}
|