Skip to content
Snippets Groups Projects
Commit 6297f4f0 authored by August Svensson's avatar August Svensson
Browse files

bare3_3

parent a857e888
No related branches found
No related tags found
No related merge requests found
......@@ -40,7 +40,7 @@ fn main() -> ! {
hprintln!("").unwrap();
let a: [u8; 4] = [65u8; 4];
//let mut a = [0u8; 4];
let mut a = [0u8; 4];
hprintln!("").unwrap();
hprintln!("a = {}", core::str::from_utf8(&a).unwrap()).unwrap();
......@@ -98,7 +98,9 @@ fn main() -> ! {
//`
// Run the program, what happens and why?
//
// ** your answer here **
// ** Rust allows this shadowing and therefore builds without error.
// When the program runs, the last hprintln! prints "a =" without any characters.
// This is because a = [0, 0, 0, 0] and 0 in utf8 is the NULL character. **
//
// Commit your answers (bare3_3)
//
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment