Search code examples
caplcanoe

array length in CAPL using symbolic constants


I'm defining an array in CAPL with 'int array[5]'.

It would be useful to define the length of this array using a define, such as it can be done in C:

#define LEN 5
int array[LEN];

Is there a way to obtain the same result with the tools at our disposal in Vector CAPL language?


Solution

  • To obtain similar result use const type qualifier.

    const word LEN = 5;
    int array[LEN];
    

    You can use different datatype than word (unsigned, 2 Byte), ex int (signed, 2 Byte) ...