Dan Erickson wrote: > My next question would be, is data held in between memory addresses? > > For instance, you have 0x240, you then store whatever you want at > the start of it, and at the end of the data, is the next memory > address, etc... etc.. Each address can hold exactly one byte (8 bits), so storing a two-byte value at address 0x240 actually stores the first byte of the value into the memory byte at address 0x240, and the second byte of the value into the memory byte at address 0x241. A four byte value stored at address 0x240 would use memory at addresses 0x240, 0241, 0x242, and 0x243. A student once expressed this as "memory is like an egg carton, each cell can hold exactly one egg". i.e. Memory cells are not elastic. > P.S. In bytes... how much room is in between 0x240 and 0x243 (I want > to make sure I am doing the math correctly) There are single-byte memory cells at 0x240, 0x241, 0x242 and 0x243. Four bytes is all there is in the 0x240 - 0x243 address range. Since you asked about address arithmetic ... Beware of C language pointer arithmetic. When you add an integer to a pointer, the address "counts" in units of the length of the type of object pointed to rather than by one. This is a point of frustration for those learning C. For example, if one declares a pointer to a long integer, "long *lp;" (assume here that long integers are four bytes in length) and loads the pointer with the address of an array of long integers, so as to use arithmetic to point to particular array elements, the expression "lp + 4" points to byte 16 of the array (fifth array element), not byte 4 (second array element). i.e. "pointer + N" points to the same address as "&pointer[N]". Just remember that arithmetic on pointers does not work like arithmetic on integers. Good luck, Ed Vance ---------------------------------------------------------------- Ed Vance edv@macrolink.com Macrolink, Inc. 1500 N. Kellogg Dr Anaheim, CA 92807 ---------------------------------------------------------------- -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/