How to dereference a pointer

Hi B&R community

I was wondering if there is a way to dereference a pointer value. the program that i have walks through an array filled with addresses of different output variables.
When searching online the symbol ^ could be used in a way like:
PointerArray[x ]^:=true
To set the original value stored in that adress to true without changing the adress stored in the array.

Basically you need to use the ACCESS keyword and the ADR() function.

Using your example would be

CurrentValue ACCESS ADR(PointerArray[x]);
CurrentValue := TRUE;

Or if the PointerArray contains the addresses or is already a reference then you can omit the ADR()

CurrentValue ACCESS PointerArray[x]
CurrentValue := TRUE;

This is explained in detail with examples in Automation Help: Dynamic variables

1 Like

Thank you for sharing the source. This has fixed the issue :ok_hand: