]> git.lizzy.rs Git - rust.git/blob - src/libstd/os/raw/char.md
Auto merge of #47956 - retep998:is-nibbles, r=BurntSushi
[rust.git] / src / libstd / os / raw / char.md
1 Equivalent to C's `char` type.
2
3 [C's `char` type] is completely unlike [Rust's `char` type]; while Rust's type represents a unicode scalar value, C's `char` type is just an ordinary integer. This type will always be either [`i8`] or [`u8`], as the type is defined as being one byte long.
4
5 C chars are most commonly used to make C strings. Unlike Rust, where the length of a string is included alongside the string, C strings mark the end of a string with the character `'\0'`. See [`CStr`] for more information.
6
7 [C's `char` type]: https://en.wikipedia.org/wiki/C_data_types#Basic_types
8 [Rust's `char` type]: ../../primitive.char.html
9 [`CStr`]: ../../ffi/struct.CStr.html
10 [`i8`]: ../../primitive.i8.html
11 [`u8`]: ../../primitive.u8.html