Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What exactly is a byte and what does it have to do with binary?

Tags:

c#

binary

byte

bit

I'm just learning about binary and bytes. I understand that 8 bits make up a byte and that a byte can have 256 possibilities. The thing I am confused about is this:

byte[] b = new byte[] { 85, 85, 67, 75 };

What does 85 or any of the numbers above have to do with binary. There is simply something not fully clicking in my mind.

like image 428
Frankie J Avatar asked Nov 18 '11 02:11

Frankie J


1 Answers

Binary is how things are stored inside the computer. Ones and zeros, on and off, true and false, the presence or absence of an electric current. This Wikipedia article gives it a fairly thorough treatment.

A representation like "85" in your example is how a byte is formatted for our convenience as human readers. It could be formatted in hexadecimal (base 16) as "55", in octal (base 8) as "125" in binary as "1010101", or even "11" in base-84 if you were so inclined. All mean the same thing.

like image 168
Bob Kaufman Avatar answered Oct 18 '22 21:10

Bob Kaufman