> For the complete documentation index, see [llms.txt](https://mentebinaria.gitbook.io/manual-da-linguagem-gnu-c/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mentebinaria.gitbook.io/manual-da-linguagem-gnu-c/11.-tipos-primitivos/tipos-de-dados-inteiros/inteiros-estreitos.md).

# Inteiros Estreitos

Os tipos que são mais estreitos que `int` raramente são usados para variáveis comuns — em vez disso, usamos `int`. Isso ocorre porque C converte esses tipos mais estreitos para `int` em qualquer operação aritmética. Literalmente, não há razão para declarar uma variável local como `char`, por exemplo.

Particularmente, se o valor for realmente um caractere, você deve declarar a variável como `int`. **Não como `char`!** Usar esse tipo estreito pode forçar o compilador a truncar valores durante a conversão, o que é um desperdício. Além disso, algumas funções retornam um valor de caractere ou `-1` para indicar "nenhum caractere". Usar `int` permite distinguir `-1` de um caractere pelo sinal.

Os tipos inteiros estreitos são úteis como partes de outros objetos, como arrays e estruturas. Compare estas declarações de arrays, cujos tamanhos em processadores de 32 bits são mostrados:

```c
signed char ac[1000];   /* 1000 bytes */
short as[1000];         /* 2000 bytes */
int ai[1000];           /* 4000 bytes */
long long all[1000];    /* 8000 bytes */
```

Além disso, cadeias de caracteres (*strings*) devem ser compostas por `char`, porque é isso que todas as funções padrão da biblioteca esperam. Assim, o array `ac` poderia ser usado como uma cadeia de caracteres, mas os outros não.


---

# 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://mentebinaria.gitbook.io/manual-da-linguagem-gnu-c/11.-tipos-primitivos/tipos-de-dados-inteiros/inteiros-estreitos.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.
