# 4. Ma'lumot turlari turlari

## Ma'lumot turlari

Operatsion tizim xotirani ajratadi va saqlanadigan xotirada saqlanadigan narsalarni o'zgaruvchining ma'lumotlar turiga qarab tanlaydi. Ma'lumotlar turi identifikatordan to'g'ri foydalanishni, qanday ma'lumotlarni saqlashni va qaysi turdagi operatsiyalarni bajarishni belgilaydi.

{% hint style="info" %}
C ++ ni o'zida ichki o'rnatilgan bir qator turlari mavjud.
{% endhint %}

## Ibtidoiy o'rnatilgan turlari (Primitive Built-in Types)

C ++ dasturchiga o'rnatilgan va foydalanuvchi tomonidan aniqlangan ma'lumotlar turlarining boy assortimentini taklif etadi. Quyidagi jadvalda C ++ ma'lumotlarining yettita asosiy turlari keltirilgan:

| T**ur (Type)**            | **Kalit so'z (Keyword)** |
| ------------------------- | ------------------------ |
| **Boolean**               | **bool**                 |
| **Character**             | **char**                 |
| **Integer**               | **int**                  |
| **Floating point**        | **float**                |
| **Double floating point** | **double**               |
| **Valueless**             | **void**                 |
| **Wide character**        | **wchar\_t**             |

Ushbu turdagi modifikatorlardan biri yoki bir nechtasi yordamida bir nechta asosiy turlarni o'zgartirish mumkin:

* imzolangan (**signed**)
* imzosiz (**unsigned**)
* qisqa (**short**)
* uzun (**long**)

Quyidagi jadval o'zgaruvchilar turini, qiymatni xotirada saqlash uchun qancha xotira kerakligini va bunday turdagi o'zgaruvchilarda saqlanishi mumkin bo'lgan maksimal va minimal qiymatlarni ko'rsatadi.

| Turi                   | Bit kengligi | Diapazon                        |
| ---------------------- | ------------ | ------------------------------- |
| **char**               | **1 byte**   | **-127 to 127 or 0 to 255**     |
| unsigned char          | 1 byte       | 0 to 255                        |
| signed char            | 1 byte       | -127 to 127                     |
| **int**                | **4 bytes**  | **-2147483648 to 2147483647**   |
| unsigned int           | 4 bytes      | 0 to 4294967295                 |
| signed int             | 4 bytes      | -2147483648 to 2147483647       |
| short int              | 2 bytes      | -32768 to 32767                 |
| unsigned short int     | 2 bytes      | 0 to 65,535                     |
| signed short int       | 2 bytes      | -32768 to 32767                 |
| long int               | 8 bytes      | -2,147,483,648 to 2,147,483,647 |
| signed long int        | 8 bytes      | same as long int                |
| unsigned long int      | 8 bytes      | 0 to 4,294,967,295              |
| long long int          | 8 bytes      | -(2^63) to (2^63)-1             |
| unsigned long long int | 8 bytes      | 0 to 18,446,744,073,709,551,615 |
| **float**              | 4 bytes      |                                 |
| **double**             | 8 bytes      |                                 |
| long double            | 12 bytes     |                                 |
| wchar\_t               | 2 or 4 bytes | 1 wide character                |

Quyida sizning kompyuteringizda turli xil ma'lumotlar turlarining to'g'ri hajmini yaratadigan misol keltirilgan.

```cpp
#include <iostream>
using namespace std;

int main() {
   cout << "Size of char : " << sizeof(char) << endl;
   cout << "Size of int : " << sizeof(int) << endl;
   cout << "Size of short int : " << sizeof(short int) << endl;
   cout << "Size of long int : " << sizeof(long int) << endl;
   cout << "Size of float : " << sizeof(float) << endl;
   cout << "Size of double : " << sizeof(double) << endl;
   cout << "Size of wchar_t : " << sizeof(wchar_t) << endl;
   
   return 0;
}
```

Natija:

```cpp
Size of char : 1
Size of int : 4
Size of short int : 2
Size of long int : 4
Size of float : 4
Size of double : 8
Size of wchar_t : 4
```


---

# 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://isystem.gitbook.io/programming/c-++-asoslari/3.-ozgaruvchilar-va-malumot-turlari-turlari.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.
