[Gambas-user] Struct with Array Field

Brian G brian at westwoodsvcs.com
Thu Apr 6 08:35:40 CEST 2023


In c terms which structure are interface for, strings and arrays are just pointer that are not initialized to a value until something is assigned to them.
When you do a  mstrct = new mystruct it creates the structure with null pointers for those fields.
--
Thanks
Brian G Wednesday, 05 April 2023, 07:55AM -07:00 from T Lee Davidson  t.lee.davidson at gmail.com :

>On 4/5/23 10:57, Mayost Sharon wrote:
> first thanks
>
> Is it supposed to be like this?
> For each field that is an array I will have to say NEW separately
>
> The fields are inside a Struct
> I thought that if I do NEW to Struct
> This will do it on all fields
>
> Thanks
>
>Simple native datatypes (such as String, Integer, Boolean) will be automatically initialized. But, objects (such as String[], 
>Integer[], Boolean[]), which are objects of classes and have properties and methods, must be initialized with the NEW keyword.
>
>
>-- 
>Lee
>
>
>----[  http://gambaswiki.org/wiki/doc/netiquette ]----
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20230406/8eef797f/attachment-0001.htm>


More information about the User mailing list