Interview Questions and Answers :: Cisco
Home > Experience Archives > Cisco > Interview Question Set 2 > Discussion
7. Difference between little endian and big endian,write a code that tells you machine is little or big endian ??
Answer:
void IsLitttleOrBigEndian()
{
char word = 1;
if((*(char *)& word) == 1 )
printf(“\n Machine is little Indianâ€);
else
printf(“\n Machine is big Indianâ€);
}
Amrita Sinha
10 Sep, 2016 2:54 AM
void IsLitttleOrBigEndian()
{
char word = 1;
if((*(char *)& word) == 1 )
printf(“\n Machine is little Indianâ€);
else
printf(“\n Machine is big Indianâ€);
}
{
char word = 1;
if((*(char *)& word) == 1 )
printf(“\n Machine is little Indianâ€);
else
printf(“\n Machine is big Indianâ€);
}
Report Error
Report Error
Please Login First Click Here