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

Answer Posted / vasundhara

int main()
{
int x=1;

if(*(char*)&x)
printf("little endian");
else
printf("big endian");

return 0;
}

Is This Answer Correct ?    7 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are disadvantages of C language.

652


How can you tell whether two strings are the same?

836


What is the difference between union and anonymous union?

841


Is exit(status) truly equivalent to returning the same status from main?

589


any function have arguments one or more OR not . it is compulsary a) any function compulsary have one or more arguments b) any function did not have arguments. It is not compulsary c) it is optional it is not compulsary d) none of the above

649






Why c is a procedural language?

587


How do you convert strings to numbers in C?

713


What is a substring in c?

592


Hi can anyone tell what is a start up code?

1622


Why doesn't C support function overloading?

1626


Write a Program to find whether the given number or string is palindrome.

618


why we wont use '&' sing in aceesing the string using scanf

1787


Was 2000 a leap year?

635


Where can I get an ansi-compatible lint?

646


What is assert and when would I use it?

585