Guest User

Untitled

a guest
Jul 17th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. struct S{
  5. int a;
  6. int b;
  7. };
  8.  
  9.  
  10.  
  11. int main()
  12. {
  13. S from;
  14. from.a = 10;
  15. from.b = 20;
  16.  
  17. // to bytes
  18. char* s_bytes = reinterpret_cast<char*>(&from);
  19.  
  20. // from bytes
  21. S *to;
  22. to = reinterpret_cast<S*>(s_bytes);
  23. }
Add Comment
Please, Sign In to add comment