Sobes.tech
Junior — Middle

How many bytes does a character occupy in ASCII encoding?

sobes.tech AI

Answer from AI

In ASCII encoding, each character takes exactly 1 byte (8 bits). This is because ASCII defines 128 characters, which can be represented in 7 bits, but for convenience, a full byte is usually used.

Example in Go:

var b byte = 'A' // the character 'A' takes 1 byte
fmt.Println(b)    // outputs 65

Thus, ASCII characters occupy 1 byte in memory.