short a=320;
how a will be represented in binary
HB LB
Now according to Little-endian .The least significant byte (LSB) value , is at the lowest address. The other bytes follow in increasing order of significance.
Now
ptr=(char *)&a;
a is type casted to char so according to Little endianness .The least significant byte (LSB) value , is at the lowest address.
So ptr will be stored like this
LA
So when the printf is executed it will print value 64.
So C is correct.