> For the complete documentation index, see [llms.txt](https://ase.lucianvilcea.ro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ase.lucianvilcea.ro/home/programare-orientata-obiect/recapitulare-c++/images-and-media.md).

# Tipuri de date primitive

C++ este un limbaj strongly-typed, adică fiecare variabilă poate reține doar valori de un anumit tip. De exemplu, nu poți reține valori întregi decât în tipuri de date destinate valorilor întregi. Din acest motiv, alegerea corectă a tipurilor de variabile necesare prelucrării datelor cu care lucrează programul face diferența dintre un program eficient și unul care consumă resurse inutil.&#x20;

**Tipurile fundamentale** de date (numite deseori și **tipuri primitive**) sunt construite direct în limbaj și pot reține valori de bază pe care le poți stoca: numere întregi, numere reale, caractere sau valori de adevăr.

### Tipuri întregi

Tipurile de date întregi pot stoca valori numerice care nu au o parte zecimală. Acestea sunt de două tipuri:&#x20;

* `signed` - pot reține valori negative
* `unsigned` - rețin doar valori pozitive

<table><thead><tr><th width="177">Tip</th><th width="208">Dimensiune</th><th width="363">Interval</th></tr></thead><tbody><tr><td><code>short</code></td><td>2</td><td>-32,768 la 32,767</td></tr><tr><td><code>int</code></td><td>4</td><td>-2,147,483,648 la 2,147,483,647</td></tr><tr><td><code>long</code></td><td>4 (32 bits) sau 8 (64 bits)</td><td>Similar cu <code>int</code> (32 bits) sau <code>long long</code> (64 bits)</td></tr><tr><td><code>long long</code></td><td>8</td><td>-9,223,372,036,854,775,808 la 9,223,372,036,854,775,807</td></tr><tr><td><code>unsigned short</code></td><td>2</td><td>0 la 65,535</td></tr><tr><td><code>unsigned int</code></td><td>4</td><td>0 la 4,294,967,295</td></tr><tr><td><code>unsigned long</code></td><td>4 (32 bits) sau 8 (64 bits)</td><td>Similar cu <code>unsigned int</code> (32 bits) sau <code>unsigned long long</code> (64 bits)</td></tr><tr><td><code>unsigned long long</code></td><td>8</td><td>0 to 18,446,744,073,709,551,615</td></tr></tbody></table>

### Tipuri reale

Spre deosebire de tipurile întregi, tipurile reale nu permit stocarea de valori `unsigned`.&#x20;

<table><thead><tr><th width="177">Tip</th><th width="208">Dimensiune</th><th width="363">Interval</th></tr></thead><tbody><tr><td><code>float</code></td><td>4</td><td>±3.4 × 10³⁸ (6-7 zecimale)</td></tr><tr><td><code>double</code></td><td>8</td><td>±1.7 × 10³⁰⁸ (15-16 zecimale)</td></tr><tr><td><code>long double</code> </td><td>8</td><td>Similar cu <code>double</code></td></tr></tbody></table>

### Tipuri caracter

Tipurile caracter permit stocarea textului.

<table><thead><tr><th width="177">Tip</th><th width="208">Dimensiune</th><th width="363">Interval</th></tr></thead><tbody><tr><td><code>char</code></td><td>1</td><td>-128 la 127</td></tr><tr><td><code>unsigned char</code> </td><td>1</td><td>0 la 255</td></tr></tbody></table>

### Tipul boolean

Tipul `bool` poate reține doar valori de adevăr (adevărat/fals).

<table><thead><tr><th width="177">Tip</th><th width="208">Dimensiune</th><th width="363">Interval</th></tr></thead><tbody><tr><td><code>bool</code></td><td>1</td><td><code>true</code> sau <code>false</code></td></tr></tbody></table>

Sursa: <https://learn.microsoft.com/en-us/cpp/cpp/data-type-ranges?view=msvc-170>


---

# 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://ase.lucianvilcea.ro/home/programare-orientata-obiect/recapitulare-c++/images-and-media.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.
