April 2026
Intermediate
631 pages
16h 20m
English
In this section, we’ll provide some practice questions to help reinforce your learning. The exercise questions cover almost all the concepts introduced in the chapter. Solutions to each exercise will follow in Section 10.5.
Resolving borrowing conflicts in mutable and immutable referencesReorganize the following code so that it adheres to Rust’s borrowing rules while still preserving the functionality of the program.
fn main() { let mut some_str = String::from("I am String"); let ref1 = &some_str; let ref2 = &mut some_str; ref2.push_str(" additional information"); println!("{ref1}"); // move this line only println!("{ref2}");}
Resolving lifetimes in function referencesModify the following code by addressing the ...
Read now
Unlock full access