Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Data | Data
C Basics

Зміст курсу

C Basics

C Basics

1. Introduction
2. Data
3. Operators
4. Control Statements
5. Functions
6. Pointers

Data

To begin with, you should know that all programs operate on data. Whether it's academic performance data from a school, activity metrics from your Instagram account, character designs from the game Fortnite, or readings from a nuclear submarine's radar—data varies widely.

In the C language, there are several fundamental data types:

• `int` (for integers);
• `float` (for decimal numbers);
• `char` (for individual characters).

Throughout this course, we'll delve deeper into these and other data types built upon these basics.

Integer

The `int` type is used for integer numbers. Imagine you're managing the books for a local business. According to your calculations, you should be seeing a profit of \$235, but in reality, you're down by \$14. Both of these numbers are integers.

Note

Business Tip: Always aim to have positive figures in your financial accounts.

Float

The `float` type is essential for decimal numbers, which is particularly useful when you need precision. Picture a 10-year-old buying what they believe to be potatoes, only to end up with three kilograms of ginger. The electronic scale reads "2.89 kg." Had we used the int type, it would simply read "2 kg." Clearly, there's a notable difference.

Char

While the `char` type is designated for characters, it technically represents an integer. The reason? ASCII. ASCII (American Standard Code for Information Interchange) is the coding system that governs how characters are stored and represented in the `char` data type. For instance, the integer 100, when interpreted as a char data type, becomes the letter `'d'`.

It's interesting to note that the letter `'d'` equates to the integer 100, whereas the integer 51 corresponds to the character `'3'`—and that's the character representation, not the numeric value.

Note

While ASCII is prevalent, there are other coding systems out there, like KOI8-U.

Data types serve a critical role in determining how your computer's memory handles and processes the information (or numbers) within your program.

Все було зрозуміло?

Секція 2. Розділ 1
We're sorry to hear that something went wrong. What happened?