![]() |
![]() |
![]() |
![]() |
![]() |
|
Now suppose that nptr1 and nptr2 are both pointers into an
array. You can subtract one from the other to establish how many array
elements lie between the two addresses specified by the two pointers:
nptr2 - nptr1; /* The number of elements between the two addresses */
Of course, it makes no sense to do such a subtraction if
nptr1 and nptr2 are pointers into different arrays. Also, it
makes no sense to add the two pointers whether or not they point into just
one array:
nptr2 + nptr1; /* ??? */