> For the complete documentation index, see [llms.txt](https://krjaeh0.gitbook.io/j-log/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://krjaeh0.gitbook.io/j-log/programming/languages/c-and-c++/c-fundamentals/variables-and-types.md).

# variables and types

{% code title="example.c" %}

```c
#include <stdio.h>

int main(void)
{
    int i = 3;
    float f = 4.5;
    double d = 5.25;
    float sum;

    sum = i + f + d;
    // float f2i = (float)i;
    // float f2d = (float)d;

    // sum = f + f2i + f2d;

    printf("The sum of a a, b, and c is %f.", sum);
    return 0;
}
```

{% endcode %}

C에는 여러 가지 변수 타입이 있지만, 몇 가지 기본 타입이 있습니다:

* **정수**: 양수 또는 음수일 수 있는 정수. `char`, `int`, `short`, `long` 또는 `long long`을 사용하여 정의됩니다.
* **부호 없는 정수**: 양수만 될 수 있는 정수. `unsigned char`, `unsigned int`, `unsigned short`, `unsigned long` 또는 `unsigned long long`을 사용하여 정의됩니다.
* **부동 소수점 숫자**: 분수가 있는 실수. `float` 및 `double`을 사용하여 정의됩니다.
* **구조체**: 구조체 섹션에서 나중에 설명됩니다.

다양한 변수 타입은 그들의 범위를 정의합니다.

* `char`는 -128에서 127까지만 범위가 가능하지만, `long`은 -2,147,483,648에서 2,147,483,647까지 범위가 가능합니다.

{% hint style="info" %}
다른 컴퓨터에서는 `long` 및 다른 숫자 데이터 타입의 범위가 다를 수 있습니다. 예를 들어 64비트 컴퓨터에서는 -9,223,372,036,854,775,808에서 9,223,372,036,854,775,807까지 범위가 가능합니다.
{% endhint %}

C에는 boolean 타입이 없다는 점에 유의하세요. 일반적으로 다음과 같은 매크로로 정의하여 사용합니다:

{% code title="bool\_like.h" %}

```c
#define BOOL char
#define FALSE 0
#define TRUE 1
```

{% endcode %}


---

# 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://krjaeh0.gitbook.io/j-log/programming/languages/c-and-c++/c-fundamentals/variables-and-types.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.
