What is offset address

What is offset address?
Offset address and segment number in c programming language

Each segment has divided into two parts.

1. Segment no (4 bit)

2. Offset address (16 bit)

So, in the other words we can say memory address of any variable in c has two parts segment number and offset address.

In turbo c 3.0 a particular segment number offset address varies from 0x0000 to 0xFFFF

Suppose physical address of any variable in c is 0x500F1.
Then its segment number is 5 and offset address is 00F1.

Write a program to find the offset address of any variable?

int main(){
int x;
printf("%u ",&x); //To print offset address
printf("%p ",x); //To print segment address
printf("%p ",&x); //To print offset address
printf("%fp ",&x); //To print segment address : offset address
return 0;

C tutorial home.


ANtony said...

wow it is the best tutorials that i ever seen!!! respect!!!!

Anonymous said...

Thanks a lot for clear explanation!!

mrigendra said...

floating point not linked for the last one.

Karthik Reddy said...

best best best tutorials i have ever wanted.

hriday kannoujia said...

study co

Unknown said...

Very good tutorial. Intact best tutorial I have ever seen

Rajesh Rocks said...

Really amazing.what a depth u r carrying.
Thank you a lot:-)