Array References

Scheme: (vector-ref v i)
Pascal, C++, Java: v[i]

Scheme: (vector-set! v i value)
Pascal: v[i] := value
C++, Java: v[i] = value;

Arrays must be declared before they can be used:

Scheme: (define myarr (make-vector 100))
Pascal: var myarr: array[0..99] of integer;
C++: int myarr[100];
Java: long[] myarr = new long[100];

Indexing of arrays begins with 0 in Scheme, C++, and Java; the initial index is specified in Pascal.

Contents    Page-10    Prev    Next    Page+10    Index