Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- struct S{
- int a;
- int b;
- };
- int main()
- {
- S from;
- from.a = 10;
- from.b = 20;
- // to bytes
- char* s_bytes = reinterpret_cast<char*>(&from);
- // from bytes
- S *to;
- to = reinterpret_cast<S*>(s_bytes);
- }
Add Comment
Please, Sign In to add comment