Content deleted Content added
Thuyhung2112 (talk | contribs) Update for Stack Overflow developer survey 2025 |
apply rust syntax highlighting to type name u8 |
||
Line 337:
==== Primitive types ====
[[Integer type]]s in Rust are named based on the [[signedness]] and the number of bits the type takes. For example, {{rust|i32}} is a signed integer that takes 32 bits of storage, whereas {{
By default, integer literals are in base-10, but different [[radix|radices]] are supported with prefixes, for example, {{rust|0b11}} for [[binary number]]s, {{rust|0o567}} for [[octal]]s, and {{rust|0xDB}} for [[hexadecimal]]s. By default, integer literals default to {{rust|i32}} as its type. Suffixes such as {{rust|4u32}} can be used to explicitly set the type of a literal.{{sfn|Klabnik|Nichols|2023|pp=36-38}} Byte literals such as {{rust|b'X'}} are available to represent the [[ASCII]] value (as a {{rust|u8}}) of a specific character.{{sfn|Klabnik|Nichols|2023|p=502}}
|