Why char is of 1 byte

I want to ask why char is of 1 byte in C Language. Why it’s not of 2 byte or 4 byte. What is the basic logic behind it to kept it in 1 byte. I know in java it’s of 2 bytes. Same question for it.

Source: New Questions

1 Comment

  1. Digin Dominic

    char is 1 byte in C because it is specified so in standards.

    The most probable logic is. the (binary) representation of a char (in standard character set) can fit into 1 byte. At the time of the primary development of C, the most commonly available standards were ASCII and EBCDIC which needed 7 and 8 bit encoding, respectively. So, 1 byte was sufficient to represent the whole character set.

    OTOH, during the time Java came into picture, the concepts of extended charcater sets and unicode were present. So, to be future-proof and support extensibility, char was given 2 bytes, which is capable of handling extended character set values.

    Reply

Leave a Reply