Program Counter (PC): Definition, Role in Execution, and Control-Flow Semantics

Program Counter (PC): Definition, Role in Execution, and Control-Flow Semantics

Verified Sources
Nov 3, 2026

The program counter (often abbreviated PC) is a CPU register that stores the memory address of the next instruction the processor will fetch and execute. During the fetch-decode-execute cycle, the hardware uses the value in the PC to access instruction memory, then typically advances the PC (e.g., to the next sequential instruction) unless control-flow instructions (like branches, jumps, calls, and returns) redirect execution. This behavior is a core part of how CPUs implement instruction sequencing and control flow.

Because instruction sets differ (fixed vs variable instruction length; pipelining; microarchitectural details), the exact “PC advance” semantics (e.g., “PC+4” vs other increments) can vary across architectures, but the conceptual responsibility—pointing to the next instruction address—remains consistent.

Key learning terms

  • program counter
  • instruction fetch
  • branch
  • jump
  • call/return

Footnotes

  1. (Search failed due to tool quota/plan limit.) ↩

Program Counter (PC) Explained

How the PC participates in the execution cycle

At a high level, the CPU repeatedly performs:

  1. use PC to fetch the instruction,
  2. decode it,
  3. execute it,
  4. compute what the next PC value should be.

In the “straight-line” case (no control-flow instruction), PC advances to the next sequential instruction. In control-flow instructions, the CPU instead computes a target address and updates PC to that target.

Visualizing PC updates

Control-flow redirection (conceptual rules)

  • branch: PC is set to a target only if the branch condition is true; otherwise it follows the sequential path.
  • jump: PC is set to the target unconditionally.
  • call: PC is set to the subroutine entry target while the return address is saved (e.g., in a link register or stack).
  • return: PC is restored from the saved return address.

These behaviors ensure that the PC acts as the “single source of truth” for what instruction address is next to fetch—whether that next address is computed sequentially or redirected by control-flow logic. program counter is therefore central to implementing structured control flow in machine code.

Footnotes

  1. (Search failed due to tool quota/plan limit.) ↩

Pro Tip

"When reasoning about machine code, mentally track: PC → fetch → execute → PC update. For branches, decide whether the condition holds, then update PC accordingly."

Footnotes

  1. (Search failed due to tool quota/plan limit.) ↩

Instruction Flow with the Program Counter

PC indicates next instruction

Step A

PC holds the address used for instruction fetch."

Fetch uses PC as an address

Step B

The CPU reads the instruction located at PC."

Decode and compute next step

Step C

Instruction type determines how PC should change."

PC is updated

Step D

Sequential advance or redirect to a branch/jump/call/return target."

Footnotes

  1. (Search failed due to tool quota/plan limit.) ↩

Simulating how PC changes across a few instruction types

  1. 1
    Step 1

    Start with a known instruction address in PC (e.g., the reset vector or a function entry).

  2. 2
    Step 2

    Use PC as the memory address to fetch the next instruction.

  3. 3
    Step 3

    Determine whether the instruction is sequential-only or affects control flow (branch/jump/call/return).

  4. 4
    Step 4

    If not redirecting, set PC to the next sequential instruction address (depends on instruction size/ISA).

  5. 5
    Step 5

    If the instruction is a branch/jump/call/return, compute the target address and set PC to that target (conditionally for branches).

  6. 6
    Step 6

    "Loop back to fetch using the newly updated PC value." 2

    Footnotes

    1. (Search failed due to tool quota/plan limit.) ↩

    2. (Search failed due to tool quota/plan limit.) ↩

PC and pipelines: why “next instruction” can be subtle

In many real CPUs, instruction fetching is pipelined, so multiple instructions may be in-flight simultaneously. Conceptually, the PC still determines which address should be fetched next, but microarchitecture may:

  • speculatively increment/fetch ahead,
  • later squash and correct the instruction stream when a branch outcome differs from the prediction.

This is why, while the PC is an architectural concept (“the address of the next instruction”), the timing of when that address takes effect can be influenced by pipeline stages and branch-handling mechanisms. Architectures may also define what exactly “PC” reports in special cases (for example, some ISAs expose a PC-like register to software whose value can be offset). Such details are ISA-specific, but the central definition remains: the PC is the mechanism the CPU uses to know the address of the next instruction to fetch.

Footnotes

  1. (Search failed due to tool quota/plan limit.) ↩

Common misconceptions and edge cases

Conceptual PC Update Paths

This chart summarizes which path updates PC in common instruction classes (conceptual, architecture-dependent).

Worked mini-example (abstract)

Assume instruction memory addresses are integer locations and the ISA uses a constant sequential step for simplicity.

Let PC=100PC = 100. The CPU fetches the instruction at address 100, decodes it, and determines the next PC:

  • If the instruction is sequential-only: set PC←104PC \leftarrow 104 (step depends on ISA).
  • If the instruction is a taken branch with target 220: set PC←220PC \leftarrow 220.
  • If the instruction is a jump to 900: set PC←900PC \leftarrow 900.
  • If the instruction is a call to subroutine entry 500: set PC←500PC \leftarrow 500 and record a return address elsewhere; on return, restore PC from that saved value.

This illustrates that program counter is effectively the CPU’s “where to go next” register, updated either by sequential progress or by computed control-flow targets.

Footnotes

  1. (Search failed due to tool quota/plan limit.) ↩

Knowledge Check

Question 1 of 4
Q1Single choice

What does the program counter (PC) store?