<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to POINTERs</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/56ff09f5f6/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/56ff09f5f6/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/56ff09f5f6/</id><updated>2022-09-26T15:45:01.196000Z</updated><subtitle>Recent posts to POINTERs</subtitle><entry><title>POINTERs</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/56ff09f5f6/?limit=25#0a75" rel="alternate"/><published>2022-09-26T15:45:01.196000Z</published><updated>2022-09-26T15:45:01.196000Z</updated><author><name>e60newbie</name><uri>https://forge.codesys.com/u/e60newbie/</uri></author><id>https://forge.codesys.com0dda351efd8f0f03b4e137da55a97bd3d0248a7d</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;use {attribute 'subsequent'}&lt;br/&gt;
and this problem is solved  &lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>POINTERs</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/56ff09f5f6/?limit=25#3027" rel="alternate"/><published>2020-02-27T13:55:47.363000Z</published><updated>2020-02-27T13:55:47.363000Z</updated><author><name>Anonymous</name><uri>https://forge.codesys.com/u/*anonymous/</uri></author><id>https://forge.codesys.com3dc2b395a518f8bd6856b3aa38e29d89b97f4596</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;&lt;em&gt;Originally created by:&lt;/em&gt; ph0010421&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Comingback4u hat geschrieben:&lt;/strong&gt;&lt;br/&gt;
Thanks Scott,&lt;br/&gt;
Great suggestion. I hadn't thought of using sizeof to determine the length of a data type for iterating through memory locations.&lt;br/&gt;
Regards, &lt;br/&gt;
CB&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Agree. Thanks Scott&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>POINTERs</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/56ff09f5f6/?limit=25#fc96" rel="alternate"/><published>2020-02-27T13:55:47.148000Z</published><updated>2020-02-27T13:55:47.148000Z</updated><author><name>Comingback4u</name><uri>https://forge.codesys.com/u/comingback4u/</uri></author><id>https://forge.codesys.com4364db59adc533c6ccbfd1a72bbff748ba480a32</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Thanks Scott,&lt;br/&gt;
Great suggestion. I hadn't thought of using sizeof to determine the length of a data type for iterating through memory locations.&lt;/p&gt;
&lt;p&gt;Regards, &lt;br/&gt;
CB&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>POINTERs</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/56ff09f5f6/?limit=25#be99" rel="alternate"/><published>2020-02-27T13:55:46.906000Z</published><updated>2020-02-27T13:55:46.906000Z</updated><author><name>Anonymous</name><uri>https://forge.codesys.com/u/*anonymous/</uri></author><id>https://forge.codesys.comc967563a8984f686f82f79be897631af2bdfe1c2</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;&lt;em&gt;Originally created by:&lt;/em&gt; scott_cunningham&lt;/p&gt;
&lt;p&gt;CB&lt;br/&gt;
A STRUCT should be one continuous space IF the struct elements are all the same (such as a struct if BOOLs). This becomes false when you mix data types (DWORDS don’t start at an odd memory location). &lt;/p&gt;
&lt;p&gt;I also received the “warning” message when I made the online change with Bool3, but I simply did what too many people do - I quickly clicked OK and ignored it! &lt;/p&gt;
&lt;p&gt;Your offered solution is good, with a small change - I would not use +1 in your pointer math - that assumes that a BOOL will always only use one byte of memory location... this may not be the case on all hardware platforms!  (This may  seem silly, but so does CoDeSys’ BOOL as 8 bits of space instead of 1 bit to a C programmer!). Instead, use + SIZEOF(BOOL) in the for loop and the pointer calculation.&lt;/p&gt;
&lt;p&gt;It would be interesting to see some type of OOP solution, too!  Seems close to a linked list.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>POINTERs</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/56ff09f5f6/?limit=25#aeb7" rel="alternate"/><published>2020-02-27T13:55:46.067000Z</published><updated>2020-02-27T13:55:46.067000Z</updated><author><name>Comingback4u</name><uri>https://forge.codesys.com/u/comingback4u/</uri></author><id>https://forge.codesys.com1ed5ffa72697cc71e5a05cfbb7922065bc30b5b3</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Scott,&lt;br/&gt;
I understand your example of just creating a BOOL and how there is no guarantee that bool2 will be right after bool 1 but isn't that where using a structure would fix that?&lt;/p&gt;
&lt;p&gt;For example whenever I change the structure and do an on-line change you get a warning that the variable you declared that used that structure will move to new memory locations. This moves all of the existing variables in the structure and keeps them in order. I have yet to find a device/os/compiler that doesn't put this in order when talking about CoDeSys.&lt;/p&gt;
&lt;p&gt;I'm trying to understand how to do what the original author was asking if the way I suggested is not reliable. Just trying to learn.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br/&gt;
CB&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>POINTERs</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/56ff09f5f6/?limit=25#c82a" rel="alternate"/><published>2020-02-27T13:55:45.781000Z</published><updated>2020-02-27T13:55:45.781000Z</updated><author><name>Anonymous</name><uri>https://forge.codesys.com/u/*anonymous/</uri></author><id>https://forge.codesys.com271257e44e42a5474206253de30e336d9465f8f8</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;&lt;em&gt;Originally created by:&lt;/em&gt; KevinR&lt;/p&gt;
&lt;p&gt;Wow - Scott, Thank you for this detailed description. &lt;/p&gt;
&lt;p&gt;Gesendet von meinem LYA-L29 mit Tapatalk&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>POINTERs</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/56ff09f5f6/?limit=25#4b5c" rel="alternate"/><published>2020-02-27T13:55:45.558000Z</published><updated>2020-02-27T13:55:45.558000Z</updated><author><name>Anonymous</name><uri>https://forge.codesys.com/u/*anonymous/</uri></author><id>https://forge.codesys.com9d9437614647f9ba5d299d0129c5e887b9c6bb2a</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;&lt;em&gt;Originally created by:&lt;/em&gt; scott_cunningham&lt;/p&gt;
&lt;p&gt;Please take care with pointer and reference assumptions - as was warned by others regarding memory locations!  The following screenshots show issues in the idea that a list of BOOLs will be where you expect them:&lt;/p&gt;
&lt;p&gt;This was at first build and download - note the huge gap between Bool1 and Bool2 (so reading one memory location after Bool1 would be complete garbage!):&lt;/p&gt;
&lt;p&gt;This was after I added another BOOL and performed an online change - notice Bool3 is spaced 4 bytes after Bool2:&lt;/p&gt;
&lt;p&gt;This was after I performed a clean and download - note that Bool3 is now moved relative to the online change (and is as one would "expect" - at 1 memory location after Bool2):&lt;/p&gt;
&lt;p&gt;If you are going to use a solution using POINTER TO or REFERENCE TO, please know that online changes can sometimes move variables and FBs around in memory, breaking those pointers (point to the old location, not the new one) - refresh the pointers to avoid online change problems (you can avoid online changes, but somebody else using your code may use online change...).  I am pretty sure REFERENCE TO has the same problem with online change, since behind the scenes a REFERENCE TO is a special handling of POINTER TO.&lt;/p&gt;
&lt;p&gt;Good luck!&lt;/p&gt;
&lt;p&gt;&lt;img alt="IMG: pointer" rel="nofollow" src="https://forum.codesys.com//download/file.php?id=4374"/&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="IMG: pointer" rel="nofollow" src="https://forum.codesys.com//download/file.php?id=4375"/&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="IMG: pointer" rel="nofollow" src="https://forum.codesys.com//download/file.php?id=4376"/&gt;&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>POINTERs</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/56ff09f5f6/?limit=25#97b3" rel="alternate"/><published>2020-02-27T13:55:45.278000Z</published><updated>2020-02-27T13:55:45.278000Z</updated><author><name>jzhvymetal</name><uri>https://forge.codesys.com/u/jzhvymetal/</uri></author><id>https://forge.codesys.com00e576b6c721609de763e9f258ef1bde1d7cbaef</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;First understand Codesys treats bools as one byte.  So you can not pack the bits unless you locate them to physical memory.  I already have many post on this so I will not repeat it here.&lt;/p&gt;
&lt;p&gt;Also Codesys does not allow for array of pointers or references but here is work around by making an array of structures with the pointer or reference.  I prefer references because you do not have to keep dereferencing them like pointers.  See Example below that will the number of on bools. &lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nt"&gt;TYPE&lt;/span&gt; &lt;span class="nt"&gt;DUT_REF&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt;
&lt;span class="nt"&gt;STRUCT&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="nt"&gt;xBool&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;REFERENCE&lt;/span&gt; &lt;span class="nt"&gt;TO&lt;/span&gt; &lt;span class="nt"&gt;BOOL&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nt"&gt;END_STRUCT&lt;/span&gt;
&lt;span class="nt"&gt;END_TYPE&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nt"&gt;PROGRAM&lt;/span&gt; &lt;span class="nt"&gt;TEST&lt;/span&gt;
&lt;span class="nt"&gt;VAR&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="nt"&gt;myref&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;ARRAY&lt;/span&gt;&lt;span class="cp"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="nx"&gt;..7&lt;/span&gt;&lt;span class="cp"&gt;]&lt;/span&gt; &lt;span class="nt"&gt;OF&lt;/span&gt; &lt;span class="nt"&gt;DUT_REF&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="nt"&gt;BIT00&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;BOOL&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="nt"&gt;BIT01&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;BOOL&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="nt"&gt;BIT02&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;BOOL&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="nt"&gt;BIT03&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;BOOL&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="nt"&gt;BIT04&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;BOOL&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="nt"&gt;BIT05&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;BOOL&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="nt"&gt;BIT06&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;BOOL&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="nt"&gt;BIT07&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;BOOL&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="nt"&gt;i&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;INT&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="nt"&gt;num_of_on&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;UINT&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nt"&gt;END_VAR&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nv"&gt;myref&lt;/span&gt;[&lt;span class="mi"&gt;0&lt;/span&gt;].&lt;span class="nv"&gt;xBool&lt;/span&gt; &lt;span class="nv"&gt;REF&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;BIT00&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;myref&lt;/span&gt;[&lt;span class="mi"&gt;1&lt;/span&gt;].&lt;span class="nv"&gt;xBool&lt;/span&gt; &lt;span class="nv"&gt;REF&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;BIT01&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;myref&lt;/span&gt;[&lt;span class="mi"&gt;2&lt;/span&gt;].&lt;span class="nv"&gt;xBool&lt;/span&gt; &lt;span class="nv"&gt;REF&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;BIT02&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;myref&lt;/span&gt;[&lt;span class="mi"&gt;3&lt;/span&gt;].&lt;span class="nv"&gt;xBool&lt;/span&gt; &lt;span class="nv"&gt;REF&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;BIT03&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;myref&lt;/span&gt;[&lt;span class="mi"&gt;4&lt;/span&gt;].&lt;span class="nv"&gt;xBool&lt;/span&gt; &lt;span class="nv"&gt;REF&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;BIT04&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;myref&lt;/span&gt;[&lt;span class="mi"&gt;5&lt;/span&gt;].&lt;span class="nv"&gt;xBool&lt;/span&gt; &lt;span class="nv"&gt;REF&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;BIT05&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;myref&lt;/span&gt;[&lt;span class="mi"&gt;6&lt;/span&gt;].&lt;span class="nv"&gt;xBool&lt;/span&gt; &lt;span class="nv"&gt;REF&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;BIT06&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;myref&lt;/span&gt;[&lt;span class="mi"&gt;7&lt;/span&gt;].&lt;span class="nv"&gt;xBool&lt;/span&gt; &lt;span class="nv"&gt;REF&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;BIT07&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;BIT00&lt;/span&gt;:&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;TRUE&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;BIT06&lt;/span&gt;:&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;TRUE&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;BIT07&lt;/span&gt;:&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;TRUE&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;num_of_on&lt;/span&gt;:&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;FOR&lt;/span&gt; &lt;span class="nv"&gt;i&lt;/span&gt;:&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="nv"&gt;TO&lt;/span&gt; &lt;span class="nv"&gt;SIZEOF&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;myref&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;SIZEOF&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;DUT_REF&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="k"&gt;DO&lt;/span&gt;
   &lt;span class="k"&gt;IF&lt;/span&gt; &lt;span class="nv"&gt;__ISVALIDREF&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;myref&lt;/span&gt;[&lt;span class="nv"&gt;i&lt;/span&gt;].&lt;span class="nv"&gt;xBool&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt; &lt;span class="k"&gt;THEN&lt;/span&gt;
      &lt;span class="k"&gt;IF&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;myref&lt;/span&gt;[&lt;span class="nv"&gt;i&lt;/span&gt;].&lt;span class="nv"&gt;xBool&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt; &lt;span class="k"&gt;THEN&lt;/span&gt; 
         &lt;span class="nv"&gt;num_of_on&lt;/span&gt;:&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;num_of_on&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="c1"&gt;; &lt;/span&gt;
      &lt;span class="nv"&gt;END_IF&lt;/span&gt;   
   &lt;span class="nv"&gt;END_IF&lt;/span&gt;
&lt;span class="nv"&gt;END_FOR&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;/div&gt;</summary></entry><entry><title>POINTERs</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/56ff09f5f6/?limit=25#a109" rel="alternate"/><published>2020-02-27T13:55:44.523000Z</published><updated>2020-02-27T13:55:44.523000Z</updated><author><name>dFx</name><uri>https://forge.codesys.com/u/dfx/</uri></author><id>https://forge.codesys.comfa98e5b51b9afea556a8735250784e4cd72479ba</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Why not using an array with a constant defining the length ?&lt;br/&gt;
Then access may be done by an ENUM, defining each value your array index may take.&lt;/p&gt;
&lt;p&gt;For instance,&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;VAR_GLOBAL&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="n"&gt;MyBool&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;ARRAY&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;..&lt;/span&gt;&lt;span class="n"&gt;Const&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_MAXVALUE&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="k"&gt;OF&lt;/span&gt; &lt;span class="n"&gt;BOOL&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;END_VAR&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;TYPE&lt;/span&gt; &lt;span class="n"&gt;MyBools_ENUM&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;
&lt;span class="p"&gt;(&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="k"&gt;First&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="k"&gt;Second&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="n"&gt;Third&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="n"&gt;WhatEver&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;UINT&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;END_TYPE&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Then usage is in a loop, as a standard array or this way :&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;MyBool&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;MyBools_ENUM&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;WhatEver&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;99&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;/div&gt;</summary></entry><entry><title>POINTERs</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/56ff09f5f6/?limit=25#1774" rel="alternate"/><published>2020-02-27T13:55:44.236000Z</published><updated>2020-02-27T13:55:44.236000Z</updated><author><name>Anonymous</name><uri>https://forge.codesys.com/u/*anonymous/</uri></author><id>https://forge.codesys.com6546d7c6e6270a10a552de96823ecfe82ffedb0a</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;&lt;em&gt;Originally created by:&lt;/em&gt; rickj&lt;/p&gt;
&lt;p&gt;@Comingback4u's method is platform/compiler dependent.   Struct members are not necessarily packed in a contiguous manner on all CPU architectures.&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>