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 the types of data types and explain?

673


What are the functions to open and close the file in c language?

595


What language is c written?

577


Why calloc is better than malloc?

572


What is dangling pointer in c?

625






what is stack , heap ,code segment,and data segment

2223


Can we access the array using a pointer in c language?

563


Do pointers take up memory?

658


write a c program for swapping two strings using pointer

2094


What is a structure member in c?

550


List some of the static data structures in C?

762


explain what is a newline escape sequence?

690


How many main () function we can have in a project?

614


Is c call by value?

607


Is malloc memset faster than calloc?

618