Arrays

C Scripting Language
Reference Manual
Version 4.4.0

<< Back  End  Next >>
 
 
INDEX
Introduction
Installation
Using the CSL executive
Language
   Comments
   Numbers
   Literals
   Var and const
      Arrays
      Initialization
      Static and extern
      Dynamic relocation
   Operators
   Statements and blocks
   Program flow
   Trace facility
   Exception handling
   Functions
   Predefined identifiers
Directives
System library
String library
Math library
Regular expression lib.
File library
Database library
Async Communication
Registry/Profile handling
Windows control
C API
C++ Class Interface
CSL links
  

CSL supports arrays with up to 16 dimensions. Since a var may hold any text or number, an array can take some functionality of structs:

const adr[3][2] = {
  { 1, 'fred' },
  { 2, "john" },
  { 3, 'jane' }
};

Local arrays (e.g. declared within a function) are allocated at runtime and may have variable indexes. This is a unique feature of CSL you won't find in C/C++:

var x = 12;

var aa[++x];  // aa holds 13 elements
var bb[x*2];  // bb holds 26 elements

Global arrays must be declared with constant indexes. This restriction is imposed since global var's and const's are allocated at compile time.

  Copyright © IBK Landquart Last revision: 27.05.2002 << Back  Top  Next >>