Pointers and references: Difference between revisions

Content added Content deleted
Line 2: Line 2:
=={{header|6502 Assembly}}==
=={{header|6502 Assembly}}==
===Pointers===
===Pointers===
In most languages, a number that is an operand in an instruction, such as <code>mov ax,3</code> or <code>int x = 3;</code>, is an <i>immediate number</i>, i.e. a constant that equals the value of that number. <code>6502 Assembly</code> is the opposite. A number <b>without</b> a # in front represents a memory address.
In most languages, a number that is an operand in an instruction, such as <code>mov ax,3</code> or <code>int x = 3;</code>, is an <i>immediate number</i>, i.e. a constant that equals the value of that number. 6502 Assembly is different: a number <b>without</b> a # in front represents a memory address.


<lang 6502asm>LDA $19 ;load the value at memory address $19 into the accumulator
<lang 6502asm>LDA $19 ;load the value at memory address $19 into the accumulator