c pointer arithmetic

Address + Number= Address
Address - Number= Address
Address - Address=Number
Address + Address=Illegal

Example:

void main(){
int *p=(int *)0x500;
int *q=(int *)0x510;
clrscr();
printf("%d",q-p);
getch();
}

Output:

8
Post a Comment