[Gambas-user] Struct with Array Field
Jussi Lahtinen
jussi.lahtinen at gmail.com
Thu Apr 6 23:45:59 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.
>
> To my knowledge C does not have a "new" expression/statement. So, you must
> be talking about Gambas behavior, and therfore your
> statement is incorrect. Try it for yourself and see what it prints:
> [code]
> Public Struct elevation
> a As Short
> b As Long
> c As Float
> d As String
> End Struct
>
> Public Sub main()
> Dim a As New Elevation
> Print a.a, a.b, a.c, a.d
> End
> [/code]
>
>
The topic was *objects *inside structure. They have only null pointers.
Variables are valid without further actions.
C does not have "new", but he was referring to the similar things that need
to be done in C.
Jussi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20230407/a3baccfd/attachment.htm>
More information about the User
mailing list