Is there 'byte' data type in C++?
No, there is no type called "byte
" in C++. What you want instead is unsigned char
(or, if you need exactly 8 bits, uint8_t
from <cstdint>
, since C++11). Note that char
is not necessarily an accurate alternative, as it means signed char
on some compilers and unsigned char
on others.
Yes, there is std::byte
(defined in <cstddef>
).
C++ 17 introduced it.