← Back to list

Why does C use `char` rather than `BYTE`?

Other programming language used BYTE for using Byte data type.

TheDevStory · 2022-10-29 06:20 · 20 claps · 1.0 min read
#c #c-language #data-type-in-c #byte #char
Open on Medium ↗
Wiki topics: 💻 · Programming

Why does C use char rather than BYTE?

c language

c language

Other programming language used BYTE for using Byte data type.

// in Visual Basic
Dim byteValue1 As Byte = 201 Console.WriteLine(byteValue1) Dim byteValue2 As Byte = &H00C9 Console.WriteLine(byteValue2) Dim byteValue3 As Byte = &B1100_1001 Console.WriteLine(byteValue3)

And C use char. But char mean ‘Character’ which means string data type.

// in C
unsigned char temperatura;
temperatura = -2;
signed char edad;
edad = 52;

But, why?

When C was born, they wanted to emphasize that the 1-byte data type is fit on ASCII code. Cuz 1-byte can contains 256 kinds of numbers. So, who invented C wants to express that when they declare 1-byte. That’s why they put the name char on that.

the Problem with that

Many beginners who learn C confused by the name. 1-byte also fits on small numbers. For example, ages, temperature, and some scores. But by the name, it seems like we need to use int. But int is too big for small ones.

So it's better to use char for small numbers. But semantically it's not correct. Because anyway, Char stands for character. This is an irrational element that has existed since the beginning of C.


메타데이터
post_id
21c25e4e2dce
slug
why-does-c-use-char-rather-than-byte-21c25e4e2dce
url
https://medium.com/@materokatti/why-does-c-use-char-rather-than-byte-21c25e4e2dce
canonical_url
https://medium.com/@materokatti/why-does-c-use-char-rather-than-byte-21c25e4e2dce
author_url
https://medium.com/@materokatti
status
ok
fetched_at
2026-07-16 08:29:43