google ads

Tuesday, May 19, 2009

Memory addresses

Every byte in memory has an integer memory address. Addresses start at zero and go to the maximum amount of memory that the computer has. For example, in a computer that has 256 MB of RAM the bytes would be numbered 0, 1, 2, 3, 4, 5, etc (up to the power of 2 closest to 256,000,000). Instructions and data are stored in RAM when a program is running, so each instruction or data element is identified by its memory address, or the address of its first byte because many types are longer than one byte. The CPU uses these memory addresses for all operations. One of the great advantages of higher-level language is that all these addressing details are taken care of automatically by the programming language and the programmer doesn't have to worry about them. However, it can be very useful for the programmer to be able to explicitly use memory addresses as data. This data type is called a pointer.

No comments:

Post a Comment