I have array on structure target (x: byte, y : byte).
var1 : array [1..30] of target;
actual_var : pointer to target;
value := actual_var^[5].x; ( didn't work )
actual_var := actual_var + ( sizeof(target) * 5); ( didn't work )
Where is problem?
Thanks Paul
Talk.ru: 5
Hi Paul!
Zitat: value := actual_var^[5].x; ( didn't work )
Your Pointer is no array of something so you cant use indexes
Zitat: actual_var := actual_var + ( sizeof(target) * 5); ( didn't work )
Only sizeof(Variable) not Sizeof(Datatype) is possible.
See the solutions below:
VAR Β Β var1 : ARRAY [1..30] OF target; Β Β actual_var : POINTER TO ARRAY [1..30] OF target; Β Β actual_var2: POINTER TO target; Β Β value: BYTE; Β Β value2: BYTE; END_VAR actual_var:= ADR(var1); value := actual_var^[5].x; (* works *) actual_var2:= ADR(var1); actual_var2 := actual_var2 + SIZEOF(actual_var2^) * DWORD#4; (* works *) value2:= actual_var2^.x;
Ist there any information about pointer arithmetic in st?
Try and error is a bad solution for me.
Log in to post a comment.
I have array on structure target (x: byte, y : byte).
var1 : array [1..30] of target;
actual_var : pointer to target;
value := actual_var^[5].x; ( didn't work )
actual_var := actual_var + ( sizeof(target) * 5); ( didn't work )
Where is problem?
Thanks Paul
Related
Talk.ru: 5
Hi Paul!
Your Pointer is no array of something so you cant use indexes
Only sizeof(Variable) not Sizeof(Datatype) is possible.
See the solutions below:
Ist there any information about pointer arithmetic in st?
Try and error is a bad solution for me.