near pointer

(1) near pointer?
Ans:
It is 16 bit pointer.It can hold the address of variable only within 64KB data segment.It store only offset address of any variable.This offset address in cyclic in nature .










If you will increment the near pointer then offset address will reach maximum value FFFF (in hexadecimal) then 0000 and so on.
For example :
#include
void main()
{

int a=5,i;
int *ptr;
//by default it is near pointer.
ptr=&a;
for(i=0;i<300 data-blogger-escaped-i="" data-blogger-escaped-strong="">

{
printf(“\n %p”,ptr);
p++;
delay(100);
}
}

Output :
Here int two byte data type so every time offset address is increasing by two. %p gives offset address in hexadecimal number. We can perform ++,-- ,+,- relation operator (>,<,==,….) operation on offset address. We cannot perform following task. Addition of two offset address. Multiplication and division of two offset address or one offset address and another number.
More detail visit

No comments: