Insertar Array Dentro De Un Array


Subject: Insertar Array Dentro De Un Array
Buenas!.

En uno de los ejemplos que estoy haciendo, tengo que insertar un array que es el mismo.
¿ Suena raro verdad ?.

Tengo esto:

miarray = [ 1, 2, 3 ]


Y ahora hago esto:

miarray.insert(miarray)


Quedando:

miarray = [ 1, 2, 3, 1, 2, 3]


Public Sub Main()

Ejemplo1()


End

Public Sub Ejemplo1()

Dim inumeros As Integer[] = [1, 2, 3]
Dim iotrosnumeros As Integer[] = [1, 2, 3]

inumeros.Insert(iotrosnumeros)

Stop

End

Public Sub Ejemplo2()

Dim inumeros As Integer[] = [1, 2, 3]

inumeros.Insert(inumeros)

Stop

End


Motivo, el ejemplo que veo en Python. Las listas.

En Python tengo una lista como esta:

lista = [ 1, 2, 3]


Y quiero insertarle a la lista los mismos valores.

lista.append(lista[ : ])


La forma: lista[ : ] quiere resumir que va de principio a fin.

¿ Pero que estoy insertando ?.. ¿ Valores o el array en si ?.

A mi me dio pensar que iba a crear un desbordamiento de pila.
A si mismo....


Saludos

Subject: Re: Insertar Array Dentro De Un Array
Shell escribió:  
¿ Pero que estoy insertando ?.. ¿ Valores o el array en si ?


Creo que este ejemplo puede darte la respuesta:

Public Sub Main()

Dim inumeros As Integer[] = [1, 2, 3]
Dim iotrosnumeros As Integer[] = [44, 555, 66666]
Dim i As Integer

inumeros.Insert(iotrosnumeros)

For i = 0 To (inumeros.Count * SizeOf(gb.Integer)) - 1
Print i, Hex(Byte@(inumeros.Data + i), 2)
Next

End

Last edited by vuott on Monday, 29 June 2020, 14:01; edited 2 times in total
Profile PM  

Page 1 of 1


  
You cannot post new topics
You cannot reply to topics
You cannot edit your posts
You cannot delete your posts
You cannot vote in polls
You cannot attach files
You can download files
You cannot post calendar events

   

This is a "Lo-Fi" version of our main content. To view the full version with more information, formatting and images, please click here.

Powered by Icy Phoenix based on phpBB
Design by DiDiDaDo

Generation Time: 0.1306s (PHP: -41% SQL: 141%)
SQL queries: 24 - Debug Off - GZIP Enabled