Arrays

C Styled Script
Reference Manual

<< Back  End  Next >>
 
 
INDEX
Introduction
Installation
Using The CSS Executive
Language
   Comments
   Literals
   Var And Const
      Arrays
      Initialization
      Static And Extern
      Dynamic Relocation
   Operators
   Statements And blocks
   Program Flow
   Exception Handling
   Functions
   Predefined Identifiers
Directives
System Library
String Library
Regular Expression Lib.
File Library
Database Library
C API
C++ API
CSS Links
  

CSS 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 CSS 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 LandquartLast revised by Peter Koch, 24.02.00<< Back  Top  Next >>