Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
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
You can’t perform that action at this time.