Character and String
This lesson discusses character and string type.
We'll cover the following
Character
The variable is used to store a single character value, such as a single digit or a single alphabet. The value assigned to a char variable is enclosed in a single quote(''
) .
Note: Unlike some other languages, a character in Rust takes up 4 bytes rather than a single byte. It does so because it can store a lot more than just an ASCII value like emojis, Korean, Chinese, and Japanese characters.
Create a free account to access the full course.
By signing up, you agree to Educative's Terms of Service and Privacy Policy