Difference between revisions of "Arrays"

From Final Fantasy XII Wiki
Jump to navigation Jump to search
Line 1: Line 1:
 
Virtual Machine supports either one or two dimensional arrays. Each variable type can be declared as an array. Accessing elements is done by pushing values onto the stack. So for an array:
 
Virtual Machine supports either one or two dimensional arrays. Each variable type can be declared as an array. Accessing elements is done by pushing values onto the stack. So for an array:
  
<source lang="cpp" inline>int array[2][3];</source> accessing element <source lang="cpp" inline>array[0][1]</source> is done by performing operations:
+
<nowiki><source lang="c++" inline></nowiki>int array[2][3];<nowiki></source></nowiki> accessing element <nowiki><source lang="c++" inline></nowiki>array[0][1]<nowiki></source></nowiki> is done by performing operations:
  
 
<pre>PUSHII 0
 
<pre>PUSHII 0

Revision as of 13:43, 16 July 2019

Virtual Machine supports either one or two dimensional arrays. Each variable type can be declared as an array. Accessing elements is done by pushing values onto the stack. So for an array:

<source lang="c++" inline>int array[2][3];</source> accessing element <source lang="c++" inline>array[0][1]</source> is done by performing operations:

PUSHII 0
PUSHII 1
PUSHV [array]

where [array] is number of variable array in variable table.