basic-types/char-bool-unit #182
Replies: 69 comments 23 replies
-
不知道第五行是否少了一个分号,我猜想这应该不是您想考察的地方 fn main() {
let _v: () = ();
let v = (2, 3);
assert_eq!(v, implicitly_ret_unit())
println!("Success!")
} |
Beta Was this translation helpful? Give feedback.
-
完成!第五题的I will returen...是不是手抖拼错了return😳 |
Beta Was this translation helpful? Give feedback.
-
checked! |
Beta Was this translation helpful? Give feedback.
-
请问单元类型不占用内存,那么他存放在哪里呢? |
Beta Was this translation helpful? Give feedback.
-
小白问一下,第一题size_of_val的结果为啥是4,'a'一个字符不是只有一个字节吗 |
Beta Was this translation helpful? Give feedback.
-
我需要戴眼镜了🧐,第二题我看半天,还以为char有特殊的输出方式,结果。。。 |
Beta Was this translation helpful? Give feedback.
-
想问下第一题的地方,是不是这个size_of_val() |
Beta Was this translation helpful? Give feedback.
-
我的理解是汉字是两个byte,一个byte是4bit,两个汉字共16bit
…---Original---
From: ***@***.***>
Date: Wed, Jul 6, 2022 00:08 AM
To: ***@***.***>;
Cc: ***@***.******@***.***>;
Subject: Re: [sunface/rust-by-practice] basic-types/char-bool-unit (Discussion#182)
想问下第一题的地方,是不是这个size_of_val()
是因为传入的是一个指针然后这个指针的大小是4B,所以说返回了这个结果?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
额,我应该搞错了,rust字符保存的是unicode,一个汉字是2个unicode共8字节
,2个汉字共16字节。我也不是很确定
…---Original---
From: ***@***.***>
Date: Wed, Jul 6, 2022 00:11 AM
To: ***@***.***>;
Cc: ***@***.******@***.***>;
Subject: Re: [sunface/rust-by-practice] basic-types/char-bool-unit (Discussion #182)
我是傻逼
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
第5题 implicitly_ret_unit() 返回空元祖吗? () |
Beta Was this translation helpful? Give feedback.
-
字符类型也是占用 4 个字节、布尔值占用内存的大小为 1 个字节、单元类型完全不占用任何内存 |
Beta Was this translation helpful? Give feedback.
-
Rust 的字符只能用 '' 来表示, "" 是留给字符串的。 |
Beta Was this translation helpful? Give feedback.
-
println!("Done"); |
Beta Was this translation helpful? Give feedback.
-
I'm done |
Beta Was this translation helpful? Give feedback.
-
Success(6/6) |
Beta Was this translation helpful? Give feedback.
-
basic-types/char-bool-unit
Learning Rust By Practice, narrowing the gap between beginner and skilled-dev with challenging examples, exercises and projects.
https://zh.practice.rs/basic-types/char-bool-unit.html
Beta Was this translation helpful? Give feedback.
All reactions