address_ops
address operations
Discussion: Getting the difference between two memory addresses
- Note: Pointer difference is of type
ptrdiff_t. Casting it to int may get one into trouble. - Check your code sample. But overall, for
T* aandT* b,(b - a)equal to number ofTin betweenbanda. So ifaandbare next to each other, the result will be 1, notsizeof(T)(bytes)!