Write a small C program to determine whether a machine's
type is little-endian or big-endian.

Answer Posted / anuraag

Vasudhara's solution is correct!
Still here is an alternative solution to check endianess
without using pointers...

int main()
{
int x=0x58;
char ch;
ch=x;

if(ch=0x58)
printf("Little Endian");
else
printf("Big Endian");
return 0;
}

Is This Answer Correct ?    3 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What’s a signal? Explain what do I use signals for?

614


How do you print only part of a string?

620


How do you write a program which produces its own source code as output?

612


How can I manipulate individual bits?

611


Explain the process of converting a Tree into a Binary Tree.

2111






What is structure data type in c?

575


What is the deal on sprintf_s return value?

647


Write a C program to count the number of email on text

1422


What is function prototype?

613


What is string length in c?

618


If one class contains another class as a member, in what order are the two class constructors called a) Constructor for the member class is called first b) Constructor for the member class is called second c) Only one of the constructors is called d) all of the above

626


What is the use of clrscr?

602


the real constant in c can be expressed in which of the following forms a) fractional form only b) exponential form only c) ascii form only d) both a and b

1908


I just typed in this program, and it is acting strangely. Can you see anything wrong with it?

567


Why should I use standard library functions instead of writing my own?

678