<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to 'null' initialization of Array's with structures in them</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/335d95f4b2/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/335d95f4b2/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/335d95f4b2/</id><updated>2021-08-21T08:24:55.621000Z</updated><subtitle>Recent posts to 'null' initialization of Array's with structures in them</subtitle><entry><title>'null' initialization of Array's with structures in them</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/335d95f4b2/?limit=25#7e33" rel="alternate"/><published>2021-08-21T08:24:55.621000Z</published><updated>2021-08-21T08:24:55.621000Z</updated><author><name>Ingo</name><uri>https://forge.codesys.com/u/ingo/</uri></author><id>https://forge.codesys.com5c68d36ee96ede77fa41e47910824a38e5e589c6</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;AFAIK the IEC61131 standard defines, that all variables are 0 initialized. It's more or less the other way around. You can define &lt;a class="" href="https://help.codesys.com/api-content/2/codesys/3.5.12.0/en/_cds_pragma_attribute_noinit/" rel="nofollow"&gt;noinit&lt;/a&gt; if you want to avoid this initialization.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>'null' initialization of Array's with structures in them</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/335d95f4b2/?limit=25#f084" rel="alternate"/><published>2021-08-20T13:20:27.540000Z</published><updated>2021-08-20T13:20:27.540000Z</updated><author><name>marsim</name><uri>https://forge.codesys.com/u/marsim/</uri></author><id>https://forge.codesys.comcc1069e736e2efa917f3791315cca727e4e0b01a</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hello,&lt;br/&gt;
I am currently implementing a struct, let's call it Struct1, in which i have say multiple ints and an array&lt;span&gt;[0..10]&lt;/span&gt; of Type Struct2, which can contain 1-10 Struct2's:&lt;/p&gt;
&lt;p&gt;TYPE Struct1:&lt;br/&gt;
STRUCT&lt;br/&gt;
    id : usint;&lt;br/&gt;
    name : string;&lt;br/&gt;
    vars : ARRAY&lt;span&gt;[0..10]&lt;/span&gt; of Struct2;&lt;br/&gt;
END_STRUCT&lt;br/&gt;
END_TYPE&lt;/p&gt;
&lt;p&gt;TYPE Struct2:&lt;br/&gt;
STRUCT&lt;br/&gt;
    var_name : string;&lt;br/&gt;
    var_bit_start : USINT;&lt;br/&gt;
    var_bit_length : USINT;&lt;br/&gt;
END_STRUCT&lt;br/&gt;
END_TYPE&lt;/p&gt;
&lt;p&gt;The var array can contain 1-10 structs and i dont know beforehand how many, but I want to iterate over these struct2's later on.&lt;/p&gt;
&lt;p&gt;Now my question is, if i create a Struct1 'Object', how exactly do i set the structs in the var array? Is the Struct2 array already initialized with empty struct2's? When I iterate over them, can I somehow see if they are already 'set' to a value or still empty?&lt;/p&gt;
&lt;p&gt;Thanks in advance for any help!&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>