fn main() {
let s1 = String::from("hello");
let len = calculate(&s1);
println!("The length of '{}' is {}.", s1, len);
fn calculate_length(s: &String) -> usize {
s.len()
}
1
共 2 条评论, 1 页
fn main() {
let s1 = String::from("hello");
let len = calculate(&s1);
println!("The length of '{}' is {}.", s1, len);
fn calculate_length(s: &String) -> usize {
s.len()
}
评论区
写评论明白了,谢谢!
--
👇
aozima: 根据系统情况自动选择u32还是u64
根据系统情况自动选择u32还是u64