1.

What do you understand by byte and rune data types? How are they represented?

Answer»

byte and rune are TWO integer types that are aliases for uint8 and int32 types respectively.
The byte represents ASCII characters WHEREAS the rune represents a single Unicode CHARACTER which is UTF-8 encoded by default.

  • The characters or rune literals can be represented by enclosing in single quotes like 'a','b','\n'.
  • Rune is also called a Code POINT and can also be a numeric value. For example, 0x61 in HEXADECIMAL corresponds to the rune literal a.


Discussion

No Comment Found