Dear all,
1.is it possible to declare an array, with a size taken from initializer.
In C it is:
int a[]={1,2,3}
How I do the same in codesys?
Please note, I DON'T request run-time dynamic array. I only request to don't declare a size abut take it from amount of initializers, like in C.
How array are passed in function blocks?
Var input
invar array [0..5] of int;
end var
What is passed only the "reference" or the copy of the whole array on the stack. If so, how do I only pass array by reference? I want to read from array inside of the block, but don't want to write something back.
Note: Pointers are not allowed in my company.
Thanks a lot!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2018-02-22
Originally created by: scott_cunningham
An answer to your second question:
There are two solutions for passing an array reference without passing the whole array while not using pointers:
Dear all,
1.is it possible to declare an array, with a size taken from initializer.
In C it is:
int a[]={1,2,3}
How I do the same in codesys?
Please note, I DON'T request run-time dynamic array. I only request to don't declare a size abut take it from amount of initializers, like in C.
Var input
invar array [0..5] of int;
end var
What is passed only the "reference" or the copy of the whole array on the stack. If so, how do I only pass array by reference? I want to read from array inside of the block, but don't want to write something back.
Note: Pointers are not allowed in my company.
Thanks a lot!
Originally created by: scott_cunningham
An answer to your second question:
There are two solutions for passing an array reference without passing the whole array while not using pointers:
Thanks a lot, Scott!
I would like ask Codesys (if they read) to implement Const References for that and also implement my 1. point in ST.
Why???