Create a two-dimensional array at runtime: Difference between revisions
Content added Content deleted
(+ Forth) |
|||
Line 113: | Line 113: | ||
[[Category:Forth]] |
[[Category:Forth]] |
||
: cell-matrix |
: cell-matrix |
||
create ( width height "name" ) over , * cells allot |
create ( width height "name" ) over , * cells allot |
||
does> ( x y -- addr ) dup cell+ >r @ * + cells r> + ; |
does> ( x y -- addr ) dup cell+ >r @ * + cells r> + ; |
||
5 5 cell-matrix test |
5 5 cell-matrix test |
||
36 0 0 test ! |
36 0 0 test ! |
||
0 0 test @ . \ 36 |
0 0 test @ . \ 36 |
||
==[[Java]]== |
==[[Java]]== |