How to create a vector of characters in Rust

2 Answers

0 votes
fn main() {
    let v = vec!['r', 'u', 's', 't'];
  
    println!("{:?}", v);
}
  
  
  
  
/*
run:
  
['r', 'u', 's', 't']
  
*/

 



answered Feb 6, 2023 by avibootz
0 votes
fn main() {
    static V: [char; 4] = ['r', 'u', 's', 't'];
  
    println!("{:?}", V);
}
  
  
  
  
/*
run:
  
['r', 'u', 's', 't']
  
*/

 



answered Feb 6, 2023 by avibootz

Related questions

...