That is near pointer cannot access beyond the data segment like graphics video memory, text video memory etc. Size of near pointer is two byte. With help keyword near, we can make any pointer as near pointer.

Note: In printf statement to print the offset address in hexadecimal, %p is used.

Consider following c program:

void main(){

int near * ptr=( int *)0XFFFF;

ptr++;

ptr++;

printf(“%p”,ptr);

}

Output: 0003

Explanation: When we increment or decrement the offset address from maximum and minimum value respectively then it repeats the same value in cyclicorder. This property is known as cyclic nature of offset address.

Cyclic property of offset address.

If you increment the near pointer variable then move clockwise direction. If you decrement the near pointer then move anti clockwise direction.