# Bits and Bytes

any examples or explination

on a 8bit system a byte holds 8 bits

``````B00000000  = a byte and each 0 = a bit
``````

and a bit can hold 2 states a "0" or a "1" so a byte can hold 256 states "0 -> 255"

spirit: on a 8bit system a byte holds 8 bits

A byte always holds 8 bits regardless of system.

Each bit of the byte corresponds to a power of 2, that is:

128 64 32 16 8 4 2 1 (Powers of 2. e.g., 2^2 = 4)

bit 7 6 5 4 3 2 1 0

byte 0 0 0 0 1 0 1 0

Therefore 00001010 = 0 + 0 + 0 + 0 + 8 + 0 + 2 + 0 = 10 decimal

Note that when a bit is On (1), it is that bit raised to the appropriate power of 2. That is 8 = 2 * 2 * 2

sterretje: A byte always holds 8 bits regardless of system.

This is not true in general - you might be confused with ‘octet’

The size of the byte has historically been hardware dependent and no definitive standards existed that mandated the size – byte-sizes from 1to 48 bits are known to have been used in the past. Early character encoding systems often used six bits, and machines using six-bit and nine-bit bytes were common into the 1960s.

The C and C++ programming languages define byte as an "addressable unit of data storage large enough to hold any member of the basic character set of the execution environment" (clause 3.6 of the C standard). The C standard requires that the integral data type unsigned char must hold at least 256 different values, and is represented by at least eight bits (clause 5.2.4.2.1). Various implementations of C and C++ reserve 8, 9, 16, 32, or 36 bits for the storage of a byte.

The modern de-facto standard of eight bits, as documented in ISO/IEC 2382-1:1993, is a convenient power of two permitting the values 0 through 255 for one byte. The international standard IEC 80000-13 codified this common meaning.

See source from wkipedia for references