fn char_array_to_string(char_array: &[char]) -> String {
// Use .iter() and collect to convert the char array to a String
char_array.iter().collect()
}
fn main() {
let char_array = ['H', 'e', 'l', 'l', 'o'];
// Convert the char array to a String
let result_string = char_array_to_string(&char_array);
println!("Resulting string: {}", result_string);
}
/*
run:
Resulting string: Hello
*/