how will this difference b interpretedwhen one


How will this difference b interpreted?

When one pointer is subtracted from another pointer, the number of elements between the two pointers always includes the element pointed to by one of the pointers. As an example, for s_ptr2 - s_ptr1, the difference is 3.

Subtracting s_ptr1 from s_ptr2 yields the number of elements between the two pointers: 3 elements. The compiler subtracts the addresses of the two pointers and divides the result (6 bytes) by the size of the pointed-to object. In this example, the compiler divides by 2 bytes (sizeof(short)).

 

 

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: how will this difference b interpretedwhen one
Reference No:- TGS0305539

Expected delivery within 24 Hours