-
RUST연습]변수 사이즈크기 알아보기(use std::mem::size_of;)코딩Coding/Rust연습 2021. 12. 10. 22:04728x90
use std::mem::size_of; fn main() { println!("Size of a char: {}", size_of::<char>()); // 4 bytes println!("Size of string containing 'a': {}", "a".len()); // .len() gives the size of the string in bytes println!("Size of string containing 'ß': {}", "ß".len()); println!("Size of string containing '国': {}", "国".len()); println!("Size of string containing '𓅱': {}", "𓅱".len()); }
출처 :
https://dhghomon.github.io//easy_rust/Chapter_7.html
Types - Easy Rust
Rust has many types that let you work with numbers, characters, and so on. Some are simple, others are more complicated, and you can even create your own. See this chapter on YouTube Rust has simple types that are called primitive types (primitive = very b
dhghomon.github.io
반응형'코딩Coding > Rust연습' 카테고리의 다른 글
Rust연습-curves_rs::canvas,pixel by (0) 2022.02.03 Rust연습]Easy Rust 024: Control flow 1(match+if) (0) 2021.12.12 [Rust연습]Easy Rust 024: Control flow 1(if, else if, else) (0) 2021.12.12 RUST연습]Easy Rust 022: Vecs (0) 2021.12.12 Rust연습]Shadowing (0) 2021.12.09 RUST연습]Rust Crash Course | Rustlang -44:47부터 (0) 2021.12.07 Rust☆]Understanding ☆Ownership☆ in Rust&☆The Rules of References☆ (0) 2021.12.06 Rust연습]Control Flow_While문_3.2.1.LIFTOFF!!연습 (0) 2021.12.06