What are Little Endian and Big Endian
Big endian and little endian are the terms,that tells the order in which sequence bytes are stored in memory.
Big Endian
Big Endian-Most Significant byte is stored at the lowest address.
Little Endian
Little Endian-lest Significant byte is stored at he lowest address.
The binary representation of integer 5193 in 2 bytes is
The following figure show how this integer is stored in different byte order
Little Endian
Address:-
By write a below program we can find little Endian machine and Big Endian machine.
Little Endian
Little Endian-lest Significant byte is stored at he lowest address.
The binary representation of integer 5193 in 2 bytes is
0001 0100 0100 1001 MS byte LS byte |
The following figure show how this integer is stored in different byte order
Little Endian
Address:-
2000 0100 1001 LSB 2001 0001 0100 MSB |
Big Endian
Address:-
2001 0100 1001 MSB |
#include<stdio.h> int main() { unsigned int k=1; char*c=(char*)&k; if(*c) printf("Little endian"); else printf("Big endian"); getchar(); return(0); system("pause"); } |
0 comments:
Post a Comment