Try to know first concept of how data store in little & big endian
machine register.Then take the concept of pointer,& try to
understand this code.
#include<stdio.h>
int main(void)
{
int i=1;
if((*(char*)&i)==1)
printf("The machine is little endian.
");
else
printf("The machine is big endian.
");
return 0;
}
#include<stdio.h>
int main(void)
{
int i=1;
if((*(char*)&i)==1)
printf("The machine is little endian.
");
else
printf("The machine is big endian.
");
return 0;
}
No comments:
Post a Comment