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

Program Counter (PC)

The special-purpose register that holds the memory address of the next instruction to execute.

Program Counter (PC)

What You'll Learn

You'll discover what the Program Counter is and why it's essential for a CPU to execute instructions in the right order.


What Is the Program Counter?

The Program Counter (PC) is a special-purpose register inside the CPU that holds the memory address of the next instruction the processor should fetch and execute.

Think of the PC like a bookmark in a recipe book. Just as a bookmark tells you which step to follow next when cooking, the PC tells the CPU which instruction to perform next from the program stored in memory.

How It Works

When your program runs, instructions are stored sequentially in memory, each at a specific address. The PC keeps track of where the CPU is in this sequence:

  1. Fetch: The CPU reads the instruction at the address stored in the PC
  2. Increment: After fetching, the PC automatically updates to point to the next instruction (typically PC = PC + instruction_size)
  3. Execute: The CPU performs the fetched instruction
  4. Repeat: The cycle continues with the updated PC value

Special Cases

The PC doesn't always increment sequentially. When your program encounters jumps, branches, or function calls, the PC gets updated to a completely different memory address—allowing the program to loop, make decisions, or jump to subroutines.


Key Takeaway: The Program Counter is the CPU's internal tracker that holds the memory address of the next instruction to execute, enabling the processor to step through your program systematically.