Difference between Big Endian and Little Endian
In big-endian format, whenever addressing memory or sending/storing words bytewise, the most significant byte — the byte containing the most significant bit — is stored first (has the lowest address) or sent first, then the following bytes are stored or sent in decreasing significance order, with the least significant byte — the one containing the least significant bit — stored last (having the highest address) or sent last. Little-endian format reverses this order: the sequence addresses/sends/stores the least significant byte first (lowest address) and the most significant byte last (highest address).
Following program o/p depends on endianess used.
main() { int i =300; char *ptr=&i; *++ptr=2; printf("%d",i); }
Assuming , size of int to be 4B and size of char to be 1B.
If big-endian format is followed o/p will be 131372
and else o/p will be 556.