What is memory location or Memory address?
A memory address is a location, in the memory of a computer, of a particular "word" of data. Much like a street address uniquely identifies a building, a memory address uniquely identifies a memory value.
Let’s start with the memory, every computer has some memory and every program needs some memory to run. The smallest unit of memory is a byte, which is equal to 8 bits. In a typical modern day computer or laptop you have hundreds or thousands of such bytes and each of these bytes have a unique address in hexadecimal format associated with it.
Memory addresses start from zero and increase up to the size of memory. For example, on an 8-bit computer with 4K of memory, the addresses would run from zero to 4095. (4 kibibytes is 2^12 bytes. Yes, kibibytes is the correct SI unit for memory. kilobytes is used for non-volatile storage.) This arrangement was typical of early eight-bit CPUs like the 8048 or 8051 CPUs which have a larger address bus than a data bus. Similarly A 16 bit processor, where 16 bits can only access 2^16 bytes, or 65,536 bytes,
Typically memory addresses are limited to the size of the physical address bus of the CPU. This is where you hear 32 bit or 64 bit CPU. A 32 bit CPU can address about 4.2 billion bytes of data, while, in theory, a 64 bit CPU can address up to 18 quintillion bytes of data.
What is address of a variable?
In C language, every variable gets a memory location (Address of variable) somewhere in the RAM when it is declared, which help us to access the value of that variable. This memory location has a unique address in hexadecimal format something like 0xbffd8b3c. Simply you can say, A memory location where data is stored is called address of variables.
Address or memory location of variables | welcome2protec.com |
Let’s consider a scenario: In a computer network every computer has a unique IP address if you need data from that computer we need to access that computer by using IP address. The same way if we need to access the value of variable ‘x’ we need to access memory location of that variable by using address of (&) Operator with format specifier either %p, %x or %u.
Read more about - How to access address or memory location of a variable?
0 Comments:
Post a Comment
Please don't enter any spam link in the comment box.