[Gambas-user] Structure array, at second reading, always gives the value of the last element

vuott at tiscali.it vuott at tiscali.it
Tue Aug 6 13:05:00 CEST 2019


  
Hello, 
I don't understand why at the second reading of a Structure
array I always get the value of the last element. 

Public Struct AAAA

b As Byte
 c As Short
 i As Integer
End Struct

Public Sub Main()

 Dim
a As New AAAA
 Dim aa As New AAAA[]
 Dim i As Integer

 For i = 0 To 7

aa.Push(a)
 Valorizza(i, aa[i])
 Print aa[i].b,  ' first

Next

Print
Print

 For i = 0 To 7
 Print aa[i].b, ' second

Next

End

Private Procedure Valorizza(c As Integer, s As AAAA)

 s.b =
4 * c

End
   


Con OpenStar hai Giga, SMS e i minuti che vuoi da 4,99€ al mese, per sempre. Cambi gratis quando e come vuoi e in più hai 6 mesi di INFINTY! http://tisca.li/myopen

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20190806/f90d6073/attachment.html>


More information about the User mailing list