It will be a reference, because it's a VAR_IN_OUT.
it's a little weird debugging the array online. It just shows as a POINTER TO INT, and you can't actually see the array from the function side. But you can still work with it as a normal array, not a pointer.
I have a Array of constant size defined like this
Now I want to pass this array to a function by reference,
but when I run this it gives strange Errors
Last edit: apurv 2024-01-07
Could not find the solution to this issue but I have side stepped this by creating a global variable MAX_SIZE.
maybe this would be a better approach, then you don't have to pass the constant at all.
see here as well
https://help.codesys.com/api-content/2/codesys/3.5.12.0/en/_cds_datatype_array/
Last edit: tvm 2024-01-08
okay but will this pass the array by copying it or it will be a reference to original array only.
It will be a reference, because it's a VAR_IN_OUT.
it's a little weird debugging the array online. It just shows as a POINTER TO INT, and you can't actually see the array from the function side. But you can still work with it as a normal array, not a pointer.