[Duda] Array - Formas de Guardar
#2

Las llaves se usan para separar los index en varias dimenciones. Mнralo asн:

pawn Код:
new array[][] =
{
    {0, 0},
    {0, 1},
    {0, 2},
    {0, 3},
    {0, 4}
};

new array2[][] =
{
    { // index 0
        0, // index 0, 0
        0 // index 0, 1
    },
    { // index 1
        0, // index 1, 0
        1 // index 1, 1
    },
    { // index 2
        0, // index 2, 0
        2 // index 2, 1
    },
    { // index 3
        0, // index 3, 0
        3 // index 3, 1
    },
    { // index 4
        0, // index 4, 0
        4 // index 4, 1
    }
};

printf("%i", array2[2][1]);// 2
printf("%i", array2[4][1]);// 4

Sin las llaves, cuando tenes 2 o 3 dimensiones no habrнa forma de separarlas ya que serнan todas comas.

Sobre el [] al crear un array sin tamaсo el tamaсo se calcula sуlo.

PD: En el primer ejemplo es [], no [][] (me equivoquй cuando puse [][] en el ejemplo que te di en el otro post)
Reply


Messages In This Thread
[Duda] Array - Formas de Guardar - by CrashCar - 05.10.2014, 14:43
Respuesta: [Duda] Array - Formas de Guardar - by [J]ulian - 05.10.2014, 15:22
Re: [Duda] Array - Formas de Guardar - by CrashCar - 05.10.2014, 15:48
Respuesta: Re: [Duda] Array - Formas de Guardar - by [J]ulian - 05.10.2014, 16:05
Re: Respuesta: Re: [Duda] Array - Formas de Guardar - by CrashCar - 05.10.2014, 16:16

Forum Jump:


Users browsing this thread: 1 Guest(s)