> 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/tipos-com-ou-sem-sinal.md).

# Tipos Com ou Sem Sinal

Um tipo inteiro **sem sinal** pode representar apenas números positivos e zero. Um tipo **com sinal** pode representar tanto números positivos quanto negativos, em um intervalo distribuído quase igualmente em ambos os lados do zero. Por exemplo, `unsigned char` armazena números de 0 a 255 (na maioria dos computadores), enquanto `signed char` armazena números de -128 a 127. Cada um desses tipos possui 256 valores possíveis, já que ambos ocupam 8 bits.

Escreva `signed` ou `unsigned` antes da palavra-chave do tipo para especificar se o tipo é com ou sem sinal. No entanto, os tipos inteiros diferentes de `char` são, por padrão, **com sinal**; com eles, `signed` é um termo redundante.

O `char` simples pode ser **com sinal** ou **sem sinal**; isso depende do compilador, da máquina em uso e do sistema operacional.

Em muitos programas, não faz diferença se `char` é com ou sem sinal. Quando isso for relevante, não deixe ao acaso; escreva explicitamente `signed char` ou `unsigned char`.

***

**Nota pessoal de Richard Stallman**: Uma vez comendo com hackers em um restaurante de peixes, pedi um prato chamado *Arctic Char*. Quando minha refeição chegou, notei que o chef não a havia assinado. Então reclamei: "Este char está sem sinal—eu queria um char com sinal!" Ou, melhor, teria dito isso se tivesse pensado rápido o suficiente.

{% hint style="info" %}
A piada acima funciona em inglês porque, em inglês, "*signed"* também significa "assinado" e no mundo da gastronomia existem os pratos assinados, de chefs famosos/as, etc.
{% endhint %}


---

# 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/tipos-com-ou-sem-sinal.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.
