February 2022
Intermediate to advanced
140 pages
2h 28m
English
| Puzzle 14 | Structure Sizing |
| | use std::mem::size_of; |
| | |
| | struct VeryImportantMessage { |
| | _message_type: u8, |
| | _destination: u16 |
| | } |
| | |
| | fn main() { |
| | println!( |
| | "VeryImportantMessage occupies {} bytes.", |
| | size_of::<VeryImportantMessage>() |
| | ); |
| | } |
Guess the Output | |
|---|---|
|
|
Try to guess what the output is before moving to the next page. |
The program will display the following output:
| | VeryImportantMessage occupies 4 bytes. |
_message_type and _destination are sized as you would expect, occupying 1 and 2 bytes ...
Read now
Unlock full access