Skip to main content

Compiler Error C0049

Message: The constant index '<index value>' is not within the range from '<start index>' to '<end index>'

Possible error cause: An index is specified that is outside the size of the array.

Error correction: Use only indexes that are within the size of he array.

Example 348. Example of the error:
PROGRAM PLC_PRG
VAR
    arr1 : ARRAY[1..2] OF INT;
END_VAR
arr1[3] := 1;

Message:

C0049: The constant index '3' is not within the range from '1' to '2'

Error correction:

arr1[2] := 1;