Three-Address Code: Operand Count and Meaning

Three-Address Code: Operand Count and Meaning

Verified Sources
Nov 4, 2026

In compiler design, three-address code is a form of intermediate code in which each instruction is represented using three addresses (fields that denote locations/identifiers). A typical instruction has the form:
(result)  =  (arg1)  op  (arg2)\text{(result)} \;=\; \text{(arg1)} \;\text{op}\; \text{(arg2)}
So, a three-address statement conceptually uses three operand “addresses”: the two operands (arg1, arg2) and the destination/result address.

A standard contrast is:

  • one-address code: fewer explicit address fields.
  • two-address code: two fields (e.g., x=x  +  yx = x \;+\; y style).
  • three-address code: separates operands from destination.

Therefore, for the multiple-choice question:

A three-address code uses (iii) Three operands.

However: note the wording “operands” can be ambiguous—some textbooks say “three addresses/fields,” while others say “operands including destination.” In either interpretation, three-address code corresponds to the choice that includes three operand/address fields (two sources + one destination).

Expected answer: (iii) Three operands.

Footnotes

  1. Wikipedia: Three-address code (compiler intermediate representation) - https://en.wikipedia.org/wiki/Three-address_code - Describes the general form of three-address code instructions. ↩

Three-Address Code (Intermediate Representation) Explained

Key idea: “three addresses” = arg1, arg2, and result

A three-address instruction explicitly names:

  1. the first operand address (arg1),
  2. the second operand address (arg2),
  3. the result/destination address (result).

This is why three-address code is often written like:

  • t1=a+bt1 = a + b
  • t2=t1∗ct2 = t1 * c

Here, each line has two source operands and one destination temporary—three address fields total. three-address code temporary variable intermediate representation

Footnotes

  1. Wikipedia: Three-address code (compiler intermediate representation) - https://en.wikipedia.org/wiki/Three-address_code - Describes the general form of three-address code instructions. ↩

How to identify the answer from the definition

  1. 1
    Step 1

    Three-address code instructions use three explicit address fields.

  2. 2
    Step 2

    Two fields correspond to input operands, and one field corresponds to the output/destination.

  3. 3
    Step 3

    Three explicit fields ⇒ choose (iii) Three operands.

  4. 4
    Step 4

    "Example like t1=a+bt1 = a + b has sources a,ba,b and destination t1t1 (three addresses total)."

    Footnotes

    1. Wikipedia: Three-address code (compiler intermediate representation) - https://en.wikipedia.org/wiki/Three-address_code - Describes the general form of three-address code instructions. ↩

Pro Tip

"When MCQs say “three-address code,” interpret it as “three address fields per instruction.” For an arithmetic form, that’s usually two sources + one destination."

Footnotes

  1. Wikipedia: Intermediate representation (compiler) and IR concepts - https://en.wikipedia.org/wiki/Intermediate_representation - Context on IR and why different IR formats use explicit fields. ↩

Beware ambiguous wording

"Some questions say “operands” but mean “addresses/fields.” If the option set is (One/Two/Three/No operands), pick the one that corresponds to three explicit fields (arg1, arg2, result)."

Footnotes

  1. Textbook-style overview source (general definition usage) - https://www.geeksforgeeks.org/three-address-code/ - Explains three-address code as having operands and a destination/result field. ↩

Operand/Address Fields by Code Style

Typical number of explicit address fields per instruction

Where three-address code fits in compilation

Parse & build syntax/semantic info

Front end

Source constructs are analyzed to generate an intermediate form."

Emit three-address code

IR generation

Each operation becomes an instruction with arg1, arg2, result fields."

Simplify and improve IR

Optimization

Using explicit temporaries/destinations helps local analysis and rewrites."

Select target instructions

Back end

Lower IR to assembly/bytecode while respecting semantics."

Footnotes

  1. Wikipedia: Three-address code (compiler intermediate representation) - https://en.wikipedia.org/wiki/Three-address_code - Describes the general form of three-address code instructions. ↩

Quick FAQ

Knowledge Check

Question 1 of 3
Q1Single choice

A three-address code uses how many operands/address fields per instruction?