Commit 3eec134f authored by DevDoggo's avatar DevDoggo

Made types explicit

parent 0e9ce7b9
......@@ -14,20 +14,22 @@ extern crate cortex_m_debug;
fn main() {
let s = "ABCD";
let bs = s.as_bytes();
let bs: &[u8] = s.as_bytes();
ipln!("s = {}", s);
ipln!("bs = {:?}", bs);
ipln!("iterate over slice");
let c: u8;
for c in bs {
ip!("{},", c)
}
let mut a = [65u8; 4];
let a: [u8; 4] = [65u8; 4];
//let mut a = [0u8; 4];
ipln!();
ipln!("iterate iterate using (raw) indexing");
let i: u32;
for i in 0..s.len() {
ip!("{},", bs[i]);
}
......@@ -57,7 +59,7 @@ fn main() {
// ** your answer here **
//
// what is the type of `bs`
// >>array
// >>array containing u8
// ** your answer here **
//
// what is the type of `c`
......@@ -65,7 +67,7 @@ fn main() {
// ** your answer here **
//
// what is the type of `a`
// >>array
// >>array of size 4 containing u8
// ** your answer here **
//
// what is the type of `i`
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment