Data Representation Computer Science

A computer never actually stores a number, a letter, or a picture — it stores voltage levels that are either high or low, and every single thing a program manipulates is ultimately a human-chosen interpretation layered on top of that one physical fact. A bit is the smallest unit of that information, a single binary digit that is either 0 or 1, corresponding directly to one transistor's low or high state on the actual silicon this site covers at the device level. A byte groups eight bits together, giving 256 distinct patterns (2 to the 8th power), which is why a single byte is the natural unit for representing one character of text or one small number. Binary notation writes numbers using only the digits 0 and 1, with each position worth a power of two — the binary number `1011` means one eight, zero fours, one two, one one, adding up to eleven in ordinary decimal. Hexadecimal, base 16, exists purely as a convenience for humans reading binary: each hex digit (0 through 9, then A through F) represents exactly four bits, so a full byte fits neatly into two hex digits, which is why memory addresses, color codes, and MAC addresses are almost always written in hex rather than binary or decimal — it is simply more compact and easier for a person to transcribe without error. Text encoding is the agreed-upon mapping from bit patterns to characters: ASCII, the oldest and simplest widely used scheme, assigns the capital letter A to decimal 65 (binary `01000001`) and covers the basic English alphabet, digits, and punctuation in just seven bits; Unicode and its common encoding UTF-8 extend this same idea to represent essentially every writing system and symbol in use anywhere, using a variable number of bytes per character so that ASCII text happens to already be valid UTF-8, a deliberate backward-compatibility design choice. Integers are stored as fixed-width binary numbers — a 32-bit signed integer can represent roughly plus or minus two billion, with one bit conventionally reserved to indicate the sign using a scheme called two's complement, which is why integer values wrap around unexpectedly to a large negative number if a program adds past the maximum representable value, a real and common source of bugs. Floating-point numbers represent values with a fractional part by storing a sign bit, an exponent, and a mantissa (significant digits) separately, following the IEEE 754 standard nearly every modern CPU and programming language uses — this is also why `0.1 + 0.2` famously does not equal exactly `0.3` in most programming languages, because many decimal fractions simply cannot be represented exactly in binary, the same way one-third cannot be written exactly as a finite decimal.

Bits, Bytes, and Hex — One Byte, Three Views The same 8-bit pattern, read three different ways 0 1 0 1 0 0 1 1 one byte, 8 bits 01000001 = 65 as a decimal number 0x41 as two hex digits 'A' as an ASCII character
Floating-Point Has Three Separate Parts IEEE 754 single precision, 32 bits total S sign 1 bit exponent 8 bits mantissa (significant digits) 23 bits 0.1 + 0.2 does not equal exactly 0.3 in most languages because many decimal fractions have no exact finite binary form the same way 1/3 has no exact finite decimal form nearly every modern CPU and language follows this same IEEE 754 layout

Every data structure and algorithm this series covers next is built on these representations without exception — a linked list's pointer is just an integer holding a memory address, a string is just a sequence of bytes under one of these text encodings, and understanding why that integer can overflow or why that float can lose precision is what separates debugging a program from guessing at it.

Take data representation computer science further

Ask the copilot about this term, or have our engineers assess it against your process.