Course contentsShow
← Computer Science
Lesson 1083 of 2,87225. Computer Architecture FoundationsFree lesson

Program Counter and Instruction Address

Understanding the PC register that holds the memory address of the next instruction to fetch.

Program Counter and Instruction Address

You'll learn: How the Program Counter (PC) register keeps track of which instruction to execute next by storing its memory address.

What is the Program Counter?

The Program Counter (PC) is a special register in the CPU that holds the memory address of the next instruction to be fetched from memory. Think of it like a bookmark in a recipe book—it marks exactly where you are in the sequence of instructions, so you always know what to do next.

Without the PC, the CPU would have no idea which instruction to execute after completing the current one. The computer would be lost!

How the PC Works with Instruction Addresses

Every instruction in your program is stored at a specific location in memory, identified by a unique memory address. The PC holds this address value as a number.

Here's the typical flow:

  1. The PC contains address 0x1000 (for example)
  2. The CPU fetches the instruction stored at memory address 0x1000
  3. After fetching, the PC automatically increments to point to the next instruction (e.g., 0x1004 if instructions are 4 bytes)
  4. The cycle repeats

The PC During Program Execution

As your program runs sequentially, the PC continuously increments. However, when you encounter branches, jumps, or function calls, the PC gets updated to a different address—jumping to a new location in memory rather than just moving forward.

This is how your CPU executes loops, conditionals, and function calls: by changing the value stored in the PC.

Key Takeaway: The Program Counter is the CPU's "instruction pointer"—it always holds the memory address of the next instruction to fetch, enabling sequential program execution and control flow changes.