Advertisement
Guest User

Untitled

a guest
Sep 3rd, 2022
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.34 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <iomanip>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     string s;
  9.     getline(cin, s);
  10.    
  11.     const char *p = (const char*)&s;
  12.     cout << sizeof(s) << endl
  13.          << &s << endl
  14.          << (void*)&s[0] << endl;
  15.     for(int i = 0; i < sizeof(s); ++i)
  16.         cout << setfill('0') << setw(2) << hex << (int)p[i] << ' ';
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement