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.
Post a Comment