Hi,
I have a structure like this:
MY_STRUCT :STRUCT
iInt : INT := 42;
xBool : BOOL := TRUE;
rReal : REAL := 3.14;
sString : STRING[20] := 'Default';
END_STRUCT
In my code, I need to re-initialize a variable of this type. Currently, I declare two variables: myStruct_1, which changes during runtime, and myStruct_default, which remains constant.
To reset myStruct_1, I assign it like this:
myStruct_1 := myStruct_default;
The problem is that when the structure has hundreds of members or contains large arrays, memory usage becomes significant , since I’m duplicating the memory required.
Is there any other way to re-initialize a struct variable?
Something like:
myStruct_1 := MY_STRUCT();
Thanks, Marcello