I have simple question.
As we know that Char takes two bytes (16 bit), and Byte takes one byte(8 bits).
But in many programming languages there is a function that converts Char to Byte. How it is possible to convert Char to Byte without losing anything?
I have simple question. As we know that Char takes two bytes (16 bit),
Share
In C# and java char is a 16 bit Unicode character. In other (older?) languages (C, C++, etc.)
chars are 8 bit representations of ASCII characters. In those languages it makes sense to convert the types without losing anything.In C# you can convert
chars to twice as manybytes, or assume (be sure really) that thechars that you are trying to convert are 8 bitchars (look at the ASCII table) written as Unicodechars.