Little endian and Big Endian refer to the layout of byte in which the data is stored.
Big endian : Stores most significant data of information from the base address.
Little Endian : Stores from least significant data from the base address.
let us take an example :
I want to store 14 in an integer on a 32bit machine.
in the binary pattern the number is represented as 1110.
If the same is to be stored in a 32bit alignment.
Big Endian stored it like :
0000-0000 0000-0000 0000-0000 0000-1110
Little Endian stores it like :
0000-1110 0000-0000 0000-0000 0000-0000
So the following program might help you in knowing whether your machine is of Little-Endian or Big Endian Architecture.
void main()
{
int i = 1;
char *c = (char *)&i;
if ( *c == 1 )
{
cout<<" LITTLE ENDIAN";
}
else
{
cout<<" BIG ENDIAN";
}
}
Categories
FollowersBlog Archive
Jobs
Find more freelance jobs
|
Friday, November 9, 2007
Subscribe to:
Post Comments (Atom)
|
Popular Posts
|
No comments:
Post a Comment