i work on a 64 bit intel processor...i was learning about big and little endian and what i understood was that these are byte orderings within a word such that in a 64 bit data, msb will have lowest address in big endian form and the highest address in little endian form...now i have a problem:
I wrote this code
to determine whether my processor was little or big endian...
I input
0102030405060708 (this is in hex)
and hoped to get 08
and 07
and 06
and... and 01
as answer
but instead got 0
and 25
and 50
and -125
and -13
and 501
and -41
and 66
.
when I wrote the same code taking 's' as 2 byte(short), the output for 0102
was 2
and 1
(which is in accordance with little endian)...so what went wrong here?