Skip to content

Instantly share code, notes, and snippets.

@rust-play
Created March 20, 2019 03:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rust-play/58b0614de93cebdc153c6c8569e0f866 to your computer and use it in GitHub Desktop.
Save rust-play/58b0614de93cebdc153c6c8569e0f866 to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
fn main() {
let mut array: [String; 7] = Default::default();
attempt(&mut array);
println!("{:?}", array);
}
fn attempt(array: &mut [String]){
let a = "amit".to_string();
array[0] = a;
array[1] = "mom".to_string();
array[2] = "dad".to_string();
array[3] = "grandma".to_string();
array[4] = "grandad".to_string();
array[5] = "grandam1".to_string();
array[6] = "grandad2".to_string();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment