Home > Back-end >  Why character need 1 byte and not 4?
Why character need 1 byte and not 4?

Time:03-01

Character have an ASCII code which is a number(integer). Then why it only takes 1 byte and not 4 bytes "like an int value" to store it in the memory.

CodePudding user response:

ASCII is a 7 bit encoding. Most modern CPU have an 8 bit byte. On a system with 8 bit byte, a single byte is sufficient to represent a character of a 7 bit encoding. There is no need to use more bytes than one.

  •  Tags:  
  • c
  • Related