Search code examples
uppaal

How to return an array in UPPAAL?


I am trying to return an integer array in an UPPAAL function. What is the correct syntax for that?

This code snippet doesn't work:

int[] randomTest(int N)
{
    int test[2];
    test[0] = 0;
    test[1] = 1;
    return test;
}

Solution

  • Arrays are allowed for clocks, channels, constants and integer variables.

    They are defined by appending a size to the variable name,

    e.g. chan c[4]; clock a[2]; int[3,5] u[7];.

    Initialisers are used to initialise integer variables and arrays of integer variables.

    For instance, int i := 2; or int i[3] := {1, 2, 3};.