Understanding pointers
To understand a pointer, it is first necessary to understand the basics of how variables are stored in memory. For many PLC programmers, creating a variable or a tag is simply inputting a name and assigning it a data type. However, some mechanics go on under the hood. For starters, a variable is much more than just a name and a data type that holds a value. A variable is a dedicated memory block that the computer, in this case, the PLC, uses to hold a value of a specific data type. The memory block is generally not human-readable; as such, the variable name is just a human-readable facade that makes accessing and manipulating the data in the memory block easy.
Representing PLC memory
Figure 2.7 is a graphical representation of a PLC’s memory. It is a simplified way of conceptualizing how the PLC sees its memory addresses:
Figure 2.7 – A graphical representation of computer memory
As you have probably deduced,...