awesome-everything RU
↑ Back to the climb

Base CS from zero

What a value is

Crux A value is a fixed pattern of bits sitting in memory cells. The bits themselves carry no inherent meaning; meaning only arises when something decides how to read them.
◷ 20 min

You have seen that memory is a row of numbered cells, and each cell holds bits. You have seen that the CPU reads a cell by address and gets back a pattern of bits. But here is the question those lessons leave unanswered: what do those bits mean?

Suppose you read memory cell 7 and get back the 8-bit pattern 01000001. What does that represent? Is it the number 65? Is it the letter “A”? Is it part of a pixel’s red channel? The bits themselves do not carry a label. They are just eight switches — off and on — waiting to be interpreted.

This lesson defines precisely what a value is at the machine level: a fixed pattern of bits sitting in memory. Nothing more, and nothing less — until something says how to read it.

Goal

After this lesson you can define a value as a bit pattern stored in memory cells, explain that bits carry no inherent meaning on their own, trace how any concrete value (a number, a character) maps to a specific pattern of bits at a specific address, and articulate why the concept of interpretation is separate from the concept of storage.

1

A value is bits in cells. Everything a running program works with — numbers, text, colours, true/false decisions — is stored as a pattern of bits in memory cells. A value at the machine level is exactly that: a contiguous run of memory cells whose bits, taken together, encode some piece of data.

A single byte (8 bits) at address 20 might hold the bit pattern 01000001. That pattern is the value stored at address 20. The machine is indifferent to what it represents; it just stores eight bits and can retrieve them on request.

The program that put those bits there knows what they mean. Nothing else does — not the memory hardware, not the CPU arithmetic unit, not the bus. The bits are passive. They sit in their cells waiting.

2

Bits have no inherent meaning. This point is subtle but foundational. The pattern 01000001 does not automatically mean anything. It is a sequence of eight off/on states. Whether it represents:

  • the unsigned integer 65 (binary place-value: 64 + 1),
  • the ASCII character “A” (ASCII code 65 maps to “A”),
  • something else entirely,

depends entirely on how a program chooses to read it. The bit pattern is the same; the meaning is in the reading.

Compare this to a physical object: a screwdriver can be used as a lever or a chisel. Its shape does not make it one or the other — the user’s decision to apply it a certain way does. Bits are the same: their arrangement is fixed, but their interpretation is a choice made elsewhere.

3

Values live at addresses. Because values are bit patterns in memory, every value has a location: the address (or range of addresses) where its bits sit. A single-byte value occupies one address. A 4-byte value occupies four consecutive addresses. An 8-byte value occupies eight.

To use a value, the program must:

  1. Know where the value lives (its starting address).
  2. Know how large the value is (how many cells it spans).
  3. Know how to interpret the bits in those cells.

All three pieces of knowledge are separate. The memory hardware only handles step 1 (retrieving cells by address). Steps 2 and 3 are the program’s responsibility — and they are exactly what a type provides. (Types are the next lesson.)

4

Storing and retrieving a value. When a program stores a value, it picks a starting address and writes the appropriate number of bytes there. When it retrieves the value, it reads those same bytes from the same address. The bits returned are the value — raw and uninterpreted until the program applies meaning.

In a language like TypeScript, you never manage addresses directly — the runtime handles that. But the underlying machine operation is always: write bits to cells, read bits from cells. Every higher-level value manipulation is built on that foundation.

Why this works

Why draw such a sharp line between “bits in cells” and “meaning”? Because this separation explains nearly every subtle bug in programming. Type errors, buffer overflows, incorrect serialisation, data corruption — all trace back to the same root: some code read or wrote bits with a different interpretation than was intended. Understanding that bits have no built-in meaning makes those bugs comprehensible, not mysterious.

0
18
1
19
01000001
20
0
21
0
22
Cell at address 20 holds the bit pattern 01000001. The neighbouring cells are unrelated. The pattern means nothing until a program reads it with a specific interpretation.
Worked example

Tracing a value from source to cells.

Suppose a program contains the assignment const x = 65. Here is what happens at the machine level on a simplified model:

  1. The source number 65 is encoded. In 8-bit unsigned binary, 65 is 01000001 (64 + 1). This encoding is computed at compile time or load time.

  2. The runtime picks an address. Say it chooses address 20 as the storage location for x. This choice is made by the runtime’s memory allocator — the programmer does not see it.

  3. The bits are written to memory. The CPU executes a store instruction: “write the byte 01000001 to address 20.” After the instruction completes, cell 20 holds 01000001.

  4. Later, the program reads the value. When x is used, the runtime issues a load instruction: “read the byte at address 20.” The memory returns 01000001. The runtime then interprets those bits as an integer (because it knows x holds a number) and produces the number 65.

The same 8 bits went from idea → encoding → storage → retrieval → interpretation. Every step is distinct. The bits in cell 20 are the same eight off/on states throughout — their “value as 65” only exists in steps 1 and 4, where a program applies interpretation.

Common mistake

A common confusion: “the value is the number 65.” At the machine level, the value is the bit pattern 01000001. “65” is a human interpretation of that pattern. For most high-level programming this distinction does not matter — the language handles it transparently. But when you cross boundaries (write a value in one language, read it in another; send bytes over a network; read a binary file) the distinction becomes critical. Two programs must agree on the interpretation, or the same bits will produce different numbers.

Practice 0 / 5

A memory cell holds the 8-bit pattern 01000001. How many bits does this value occupy?

The unsigned 8-bit binary pattern 01000001 equals which decimal number? (Hint: place values from right are 1, 2, 4, 8, 16, 32, 64, 128.)

A 4-byte value is stored starting at address 100. Which is the last address it occupies?

Memory cell 50 holds bits 00000000. What unsigned integer does this bit pattern decode to?

A program writes the number 255 into a single byte at address 30. In 8-bit unsigned binary, 255 is 11111111. How many bits are 1 in that pattern?

Check yourself
Quiz

At the machine level, what is a value?

Recap

A value at the machine level is a pattern of bits occupying one or more consecutive memory cells. The bits are stored at a specific starting address and span a specific number of bytes. They are passive: the memory hardware stores and retrieves them without caring what they represent. Meaning is not in the bits — it is in the interpretation applied by the program that reads them. Two programs reading the same byte with different interpretations will see different values. This separation between storage and interpretation is the core idea that the concept of types formalises — and types are precisely what the next lesson covers.

Continue the climb ↑Types interpret bits
shortcuts expand
search
K
prev piece
k
next piece
j
cycle tier
t
this menu
?
sources4
expand
  1. 01
  2. 02
  3. 03
  4. 04

Trademarks belong to their respective owners. Editorial reference only.