Chars and bytes form some of the most basic data types available. But what are they really? And what can you do with them?
This will depend on what language you are using and maybe even what platform you’re building your application to run on. Some languages such as C# may have both types while others like C++ may have just one but with an idea of what the other is. And some languages may have just one or possible neither.
In general though, these types are used to hold small numeric values and character codes.
The episode also describes both signed and unsigned types and a common way of representing negative values called two’s complement. To convert between positive and negative values using two’s complement, all you have to do is first flip all the bits and then add one. This works both ways.
An easy way to tell if a signed value is negative or not is to look at the most significant bit. If it’s set to one, then the value is negative. And if it’s a zero, then the value is positive.