> For the complete documentation index, see [llms.txt](https://bla0x1s-organization.gitbook.io/untitled-1/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bla0x1s-organization.gitbook.io/untitled-1/reverse-engineering/c-programming/arrays.md).

# ARRAYS

Las arrays se utilizan para almacenar multiples valores en una sola variable , en lugar de declarar variables separadas para cada valor.

Para crear una matriz, defina el tipo de datos (como init) y especifique el nombre de la matriz seguido de corchetes \[].

Para agregar valores, use una lista separada por comas:

```c
int numeros[] = {25, 50, 75, 100};
```

Para acceder a un elemento del array se consulta su numero de indice.

Los indices comienzan con 0:

```c
#include <stdio.h>

int main () {
    int numbers[] = {25, 50, 75, 100};
    printf("%d", numbers[0]);
    return 0;
}
```

Casi de la misma manera se cambia un elemento del array:

```c
numbers[0] = 33;
```

```c
#include <stdio.h>

int main () {
    int numbers[] = {25, 50, 75, 100};
    numbers[0] = 33;
    printf("%d", numbers[0]);
    return 0;
}
```

Tambien podemos recorrer un array con un bucle for:

```c
#include <stdio.h>

int main () {
    int numbers[] = {25, 50, 75, 100};
    int i;
    
    for (i = 0; i < 4; i++) {
        printf("%d\n", numbers[i])
    }
    return 0;
}
```

Otra forma de crear Arrays es especificar el tamaño de la matriz y agregar elementos mas tarde:

```c
int numbers[4];

numbers[0] = 25;
numbers[1] = 50;
numbers[2] = 75;
numbers[3] = 100;
```

## ARRAYS MULTIDIMENCIONALES

Un array  multidimencional es un array de arrays.

Un array multidimencional  puede tener cualquier numero de dimenciones.

### Array Bidimencional

Se crea un array 2d de la sikguiente manera:

```c
int matryx[2][3] = { {1, 4, 2}, {3, 6, 8} };
```

Podemos acceder a los elementos de esta de la siguiente forma:

```c
int matryx[2][3] = { {1, 4, 2}, {3, 6, 8} };

printf("%d", matrix[0][2];)
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://bla0x1s-organization.gitbook.io/untitled-1/reverse-engineering/c-programming/arrays.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
