C# C# Streams and Data Processing Parsing Data Working with Integers

Byte - what exactly is it?

I thought a byte was a value that contained 8 binary digits, e.g., 100111001 Why then are we saying a byte can take values from 0 - 255. I'm a bit confused.

2 Answers

Steven Parker
Steven Parker
173,904 Points

The "0 - 255" spec is the decimal equivalent of the binary values. For unsigned values, 00000000 is the smallest binary byte value, which is 0 in decimal; and 11111111 is the largest, which is 255 in decimal.

Ok. So in other words, a byte has about 256 permutations of bit numbers?

Steven Parker
Steven Parker
173,904 Points

There are exactly 256 (2^8) permutations of 8 binary digits.

This was a lot of help. Thank you.