Physical address of a computer

Logical address and physical address: How to find 
or get a physical address of a RAM

physical address of computer or operating system

All the c variables are stored in the residence memory.
In turbo C 3.0, 20 bits address of the memory cell is
known as physical address or real address. In 20 bits,
we can represent address   from 0x00000 to 0xFFFFF. That
is all c variables must have memory address within this
range.



A C programmer cannot not decides what will be the memory
address of any variables. It is decided by compiler. For Example:

What will be output of following c cod

#include<stdio.h>
int main(){
    int a;
    printf("%x",&x);
    return 0;
}

Output: We cannot predict.

But we can say in 16 bits compilers address must be
within 0x0000 to 0xFFFF and in 32 bits compilers memory
address must be within 0x00000000 to 0xFFFFFFFF.

Note: Suppose your c compiler is based on the
microprocessor which total address buses are 32 then its
total size of addressable memory will be:






= 2 ^ 32 bytes
= 4 GB









C tutorial home.

7 comments:

Anuradha said...

It is little confusing
It given that residence memory is 1 mb for turboc 3.0. and it is 16 bit compiler.
How address range is from ox0000 to oxFFFF.
It should be 0x00000 to 0xFFFFF

Anonymous said...

something wrong in your example code: You only declare "a" variable, but you print x address variable.

Unknown said...
This comment has been removed by the author.
Unknown said...

Thanks....
turbo c++ 3.0 is 20bit address so
2^20 = 1MB
Where 20 is number of bit.
so here 32bit address should be 2^32 bit = 4gb. but
=2^32 byte?
=4gb?

Unknown said...

It is little confusing
It given that residence memory is 1 mb for turboc 3.0. and it is 16 bit compiler.
How address range is from ox0000 to oxFFFF.
It should be 0x00000 to 0xFFFFF

Unknown said...

Hello Naveen, I'd like to answer your question, the writer has written the right thing, he just forgot to make it clear.
2 ^ 32 Bytes, In this expression, it is not 32 Bytes, I'll write a simple English sentence so your doubt will be cleared -
"2 rest to power 32 and whatever will come will be in term of BYTES"
So the correct express will be 2 ^ 32 (Bytes)
i.e. 2 ^ 32 (Bytes) = 4294967269 Bytes that equals 4GB :)

Unknown said...

admin in case of 32 bit compiler..if i am using a computer with 2 gb ram..then how compiler will allocate this memory??