i want to ask how do you know the maximum value for example for 1 byte..
1 byte = 1111 1111 or = 255
1 nibble = 1111 or = 15
does the end value means how many characters or digits its possible!?
for example in one byte .. the maximum value that can be hold in it can be up to 255 digits? i dont have any idea .. even tho i think its too much 255 digits for a byte... can u examplin me in short words?!
A (unsigned) byte can hold values from 0 (0x00 or 0000 0000) to 255 (0xFF or 1111 1111).
To check how many different values a integer variable of given size in bits can hold you have to calculate 2 in power (amoutn of bits). Range in case of unsigned integers will be from 0 to (distinct values)-1. For byte (8 bit) it will be 2^8 = 256. So unsigned byte can hold 256 distinct values and his range 0-255.
For signed integers range is from −(distinct values / 2) to (distinct values / 2)−1
actually i know how to calulcoate but i dont know the maxium value .. for example for 1 byte maximum value is 255 .. so what means 255?! 255 digits or 0-255?
for example in one byte .. the maximum value that can be hold in it can be up to 255 digits?
No, the maximum value it can hold is 255.
11111111 is equivalent to 28 - 1
1 byte can hold up to 8 bits so it can hold the values -127 to 128 (-1111111 to 10000000). In this case it is representing a signed value so the extra 1 bit contains the sign of the number (+ or -). But an unsigned byte will use that sign bit to store an extra value that adds to the number (hence the term 'unsigned'). So it can now only store (0 to 11111111)
To answer your question, the maximum value of bits is 1. The maximum value of a group of bytes is:
2(number of bytes * 8) - 1
Ex. ints are 32 bit, so this means they contain 4 bytes. So the maximum value of int (unsigned value) is 232 - 1