Skip to content
Snippets Groups Projects
Commit 28156ff5 authored by Samuel Karlsson's avatar Samuel Karlsson
Browse files

bare3: tack 2

parent 86421ffa
Branches
No related tags found
No related merge requests found
......@@ -13,21 +13,23 @@ use core::str;
extern crate cortex_m_debug;
fn main() {
let s = "ABCD";
let bs = s.as_bytes();
let s: &str = "ABCD";
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)
ip!("{},", c);
}
let mut a = [65u8; 4];
let mut a: [u8; 4] = [65; 4];
//let mut a = [0u8; 4];
ipln!();
ipln!("iterate iterate using (raw) indexing");
let i: usize;
for i in 0..s.len() {
ip!("{},", bs[i]);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment