let assume integer takes 2 Bytes, Character takes 1 Byte and Pointer (Any type) = 4 Bytes
i=257 = 256+1 ===> 00000001 00000001 ====> For this example, O/p can not effect by endienes of system.
Values |
00000001 |
00000001 |
Memory Address |
101 |
100 |
*( (char*)iPtr ) ===> 1) iPtr converted in Character pointer (note that character pointer points only 1 Byte Memory where integer Pointer points 2 Bytes of Memory, actually depends upon size of the datatype)
===============> 2) returns the value at that Memory Address which is pointed by the iPtr
*( (char*)iPtr +1 ) ===> 1) iPtr converted in Character pointer (note that character pointer points only 1 Byte Memory where integer Pointer points 2 Bytes of Memory, actually depends upon size of the datatype)
===============> 2)increment the address by one
===============> 3) returns the value at that Memory Address which is pointed by the iPtr
o/p is 1 1
more details https://www.geeksforgeeks.org/little-and-big-endian-mystery/