SPC  Version 0.9.5
 All Files Functions Groups Pages
Variable Declaration

Variable declaration, which has already been discussed, is one type of statement.

Its purpose is to declare a local variable (with optional initialization) for use within the code block. The syntax for a variable declaration is shown below.

arg_type variables;

Here arg_type must be one of the types supported by SPC. Following the type are variable names, which must be a comma-separated list of identifiers with optional initial values as shown in the code fragment below.


Arrays of variables may also be declared:

int array[n][=initializer];

You can also define variables using user-defined aggregate structure types.

struct TPerson {
int age;
string name;
TPerson bob; // cannot be initialized at declaration