Numeric and Binary Data

Learn how C++ represents numbers and data in memory using binary, decimal, and hexadecimal systems.

Ryan McCombe
Updated
Hello! I'm here to help you with any questions about this lesson. Feel free to ask me anything - whether it's about specific concepts, examples, or how to apply what you've learned!

Questions & Answers

Answers are generated by AI models and may not have been reviewed. Be mindful when running any code on your device.

Unsigned Ints vs std::byte
Why are unsigned integers preferred for representing binary data, even though std::byte exists?
Int Width and Portability
Why is the width of int not fixed in the C++ standard, and why does it matter for portability?
Bitwise Operations
How can I perform bitwise operations like AND or OR on variables storing binary data?
Extract Red Channel
How could I use bitwise operators to extract the red channel value from a uint32_t color variable?
Check Specific Bit
How would I check if a specific bit is set (equal to 1) within a uint8_t variable?
Sizeof and Containers
Can I use sizeof with std::string or std::vector? What does the value returned by sizeof represent in this case, given that containers can have variable lengths?