fireplace_tea wrote: > Hi Everyone, > > I'm a little confused on the amount of memory each variable type takes > up in RAM. I understand about bits and bytes and ASCII. I.E. If you > type in DOG each letter is one byte, thus the entire word DOG is three > bytes. If each character is one byte how is it that a long int > variable type that can be up to 10 bytes in length only take up 4 > bytes of memory? > > Thanks, > Julie
For a 4-byte unsigned int: Bit 0 = 1 Bit 1 = 2 Bit 2 = 4 Bit 3 = 8 Bit 4 = 16 Bit 5 = 32 Bit 6 = 64 Bit 7 = 128 Bit 8 = 256 Bit 9 = 512 ... Bit 30 = 1,073,741,824 Bit 31 = 2,147,483,648 Full range is: 0 to 4,294,967,295 (2^32 - 1). What you are probably confused about is the conversion from base 2 to base 10. -- Thomas Hruska CubicleSoft President Ph: 517-803-4197 *NEW* MyTaskFocus 1.1 Get on task. Stay on task. http://www.CubicleSoft.com/MyTaskFocus/
