回答編集履歴
1
修正
    
        answer	
    CHANGED
    
    | @@ -1,11 +1,21 @@ | |
| 1 1 | 
             
            こーゆー↓ことがお望みか?
         | 
| 2 2 | 
             
            ```C++
         | 
| 3 3 | 
             
            #include <iostream>
         | 
| 4 | 
            +
            #include <sstream>
         | 
| 5 | 
            +
            #include <string>
         | 
| 4 6 |  | 
| 5 7 | 
             
            int main() {
         | 
| 6 8 | 
             
              int a;
         | 
| 7 | 
            -
             | 
| 9 | 
            +
              void* ptr = &a;
         | 
| 10 | 
            +
             | 
| 11 | 
            +
              std::string str10 = std::to_string(reinterpret_cast<unsigned long long>(ptr));
         | 
| 12 | 
            +
             | 
| 13 | 
            +
              std::ostringstream stream;
         | 
| 14 | 
            +
              stream << std::hex << ptr;
         | 
| 15 | 
            +
              std::string str16 = stream.str();
         | 
| 16 | 
            +
              
         | 
| 8 17 | 
             
              std::cout << ptr << std::endl;
         | 
| 9 | 
            -
              std::cout <<  | 
| 18 | 
            +
              std::cout << "[" + str10 + "]" << std::endl;
         | 
| 19 | 
            +
              std::cout << "[" + str16 + "]" << std::endl;
         | 
| 10 20 | 
             
            } 
         | 
| 11 21 | 
             
            ```
         | 
