# ESTRUCTURAS

Estas son formas de agrupar varias variables relacionadas en un solo lugar. Cada variable se conoce como un miembro de la estructura.

A diferencia de un Array, una estructura puede contener muchos tipos de datos diferentes (int, float, char, etc).&#x20;

### Crear

Se puede crear una estructura usando  `struct` palabra clave y declarar cada uno de los mienbros entre llaves:

```c
struct estructura {
    int num;
    char letras;
};
```

Para acceder a la estructura debe crear una variable de la misma.

```c
struct estructura {
    int num;
    char lettras;
};

int main() {
    struct estructura s1;
    return 0;
}
```

### Miembros de la Estructura de Acceso

Para acceder a los miembros de una estrucrura, use la sintaxis de punto `.`

```c
struct struct {
    int num;
    char letter;
};

int main() {
    struct struc s1;
    
    s1.num = 13;
    s1.letter = 'B';
    
    printf("Mi numero %d\n", s1.num);
    printf("Mi letra %d\n", s1.letter);
    
    return 0;
}
```

Vemos un ejemplo mas real:

```c
struct Car {
  char brand[50];
  char model[50];
  int year;
};

int main() {
  struct Car car1 = {"BMW", "X5", 1999};
  struct Car car2 = {"Ford", "Mustang", 1969};
  struct Car car3 = {"Toyota", "Corolla", 2011};

  printf("%s %s %d\n", car1.brand, car1.model, car1.year);
  printf("%s %s %d\n", car2.brand, car2.model, car2.year);
  printf("%s %s %d\n", car3.brand, car3.model, car3.year);

  return 0;
}
```


---

# Agent Instructions: 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:

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

The question should be specific, self-contained, and written in natural language.
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.
