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 is const and volatile in c?

566


Can main () be called recursively?

630


What is c programing language?

615


What is cohesion and coupling in c?

591


What is pointers in c with example?

583






what is diffrence between linear and binary search in array respect to operators?what kind of operator can be used in both seach methods?

1453


Explain the difference between malloc() and calloc() in c?

578


Can you add pointers together? Why would you?

646


What is the role of && operator in a program code?

568


can any one please explain, how can i access hard disk(physical address)? it is possible by the use of far,near or huge pointer? if yes then please explain......

1411


program to find error in linklist.(i.e find whether any node point wrongly to previous nodes instead of next node)

1629


I heard that you have to include stdio.h before calling printf. Why?

588


Difference between macros and inline functions? Can a function be forced as inline?

712


What is mean by data types in c?

552


What is chain pointer in c?

603