diff --git a/examples/bare3.rs b/examples/bare3.rs index a52a2f5988101b4b69c287082f40912f9ba5180e..3d2a21d3b03e6916d28916fc16a7b368015441c7 100644 --- a/examples/bare3.rs +++ b/examples/bare3.rs @@ -18,8 +18,11 @@ use cortex_m_semihosting::{hprint, hprintln}; #[entry] fn main() -> ! { hprintln!("bare3").unwrap(); - let s = "ABCD"; - let bs = s.as_bytes(); + let s: &str = "ABCD"; + let bs: &[u8] = s.as_bytes(); + let c: &u8; + let i: i32; + let a: [u8; 4]; hprintln!("s = {}", s).unwrap(); hprintln!("bs = {:?}", bs).unwrap(); @@ -36,7 +39,7 @@ fn main() -> ! { hprintln!("").unwrap(); - let a = [65u8; 4]; + a = [65u8; 4]; //let mut a = [0u8; 4]; hprintln!("").unwrap(); @@ -52,27 +55,38 @@ fn main() -> ! { // // 1. What is the output in the `openocd` (Adapter Output) console? // -// ** your answer here ** +// bare3 +// s = ABCD +// bs = [65, 66, 67, 68] +// iterate over slice +// 65,66,67,68,iterate iterate using (raw) indexing +// 65, +// 66, +// 67, +// 68, +// +// +// a = AAAA // // What is the type of `s`? // -// ** your answer here ** +// type string // // What is the type of `bs`? // -// ** your answer here ** +// u8 byte array // // What is the type of `c`? // -// ** your answer here ** +// Pointer for an u8 element in the bs array. // // What is the type of `a`? // -// ** your answer here ** +// it's an array of u8 // // What is the type of `i`? // -// ** your answer here ** +// a int variable, i32 // // Commit your answers (bare3_1) //