Breaking the Data Type of ‘C’ lang

TheDevStory
2 min readOct 29, 2022

c language

Learn Data Type is boring sometimes. But using data type in C language is so important. And that makes C is so powerful than others. I will explain to you these consequential data types in an easy way.

Why do we need to use this?

toilet pape

Imagine toilet paper. It's so easy to use. Because It is already divided into various pieces before we use it. Using data type also like this. we can divide data first, and after we can use it more comfortably. So, it's kind of preparing for the future. (And I always love preparing for the future 🤤)

Integer (정수)

Let's start to learn how can we prepare for our future.

char can contain a small number of integers. I mean a 1-byte amount of number. You can use int with larger than 255.

With signed you can add -. If you don’t want to use -, just write data type with unsigned ~.

  • signed char : -128 ~ 127
  • unsigned char : 0~ 255
  • signed short int : -32,768 ~ 32,767
  • unsigned short int : 0 ~ 65,535
  • signed long int : -2,147,483,648 ~ 2,147,483,647
  • unsigned long int : 0 ~ 4,294,967,295

Most of the time when we use int, you can omit part. Like

  • signed short int = short int | signed short | short
  • unsigned short int = unsigned short
  • signed long int = long int | signed long | signed int | long | int
  • unsigned long int = unsigned int | unsigned long

And many people love using most short way.

Real Number (실수)

The concept of a real number is easy. It is a number with parts other than integers. Like decimals and fractions. Real numbers are used as floating point numbers according to the IEEE 754 Standard. But in this article, I will not explain that too deeply.

the Real Number has only 2 options in C.

  • float : 4-bytes

Float can express 2⎻¹²⁶ ~ 2¹²⁸. This means 6 decimal places. You can use this to describe simple Pi.

float pi;
pi = 3.14;
  • double :8-bytes

Double can express 2⎻¹⁰²² ~ 2¹⁰²⁴. 14 decimal places. It is much bigger than Float.

float big_pi;
big_pi = 3.141592654;

🙇‍‍‍🙇‍♂️🙇‍♂️

TheDevStory
TheDevStory

Written by TheDevStory

A web developer crafting online experiences. Also football(soccer) coach and Spanish Learner.

Responses (2)

Write a response