title: How do I create an array in Forth?
body: <p>I know, the question was often asked in the past and perhaps the information are given in previous Stack&nbsp;Overflow postings. But learning Forth is a very complicated task and repetition helps to understand the advantages of a concatenative programming language over alternative languages like C.</p>
  
  <p>What I have learned from Forth tutorials is that Forth doesn't provide commands for creating a 2D array, but the user has to realize everything from scratch in the program. I've found two options in occupying memory in Forth. At first by creating a new word:</p>
  
  <pre><code>: namelist s” hello” s” world” ;
  </code></pre>
  
  <p>or secondly by the CREATE statement:</p>
  
  <pre><code>create temperature 10 allot
  temperature 10 cells dump
  </code></pre>
  
  <p>So far so good; we have created an array of 10 cells in which integer variables can be stored. But what is, if I need to save float numbers? Do I have to convert float always to int or can they saved into the normal cells?</p>
  
  <p>Another open problem is how to store string values in the array. As far as I know, a string contains a pointer plus a size. So in theory I can store only 5 strings in a 10 cell array and additionally I need memory somewhere else which holds the string itself. That doesn't make much sense.</p>
  
  <p>Is there some kind of higher abstraction available to store values in arrays which can be used to write easy to read programs? I mean, if every programmer is using his own Forth method to store something in the memory, other programmers will find it hard to read the code.</p>