how to find your architecture is LittleEndian or BigEndian?

Answer Posted / kirankumaryakkala

ans. by using unions we can find it see.
union
{
char ch[2];
int i;
}u;
u.i=512;
printf("%d %d",u.ch[0],u.ch[1]);
printf("%d",u.i);

basically u will see this type of implementation while u r
going through some C books.

depending on the storage seen at ch[0],ch[1] u can find.

u can find the output as ch[0]=0,ch[1]=2 \\little endian
(or) ch[0]=2,ch[2]=0\\bigendian
like this u can find the endian....

Is This Answer Correct ?    3 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Using functions, write a program that multiplies two arrays. Use the following functions: - Function ReadArray - Function MultiplyArrays - Function DisplayArrays

1905


Explain how can I convert a number to a string?

655


What functions are used in dynamic memory allocation in c?

604


write a c program thal will find all sequences of length N that produce the sum is Zero, print all possible solutions?

2420


What is a method in c?

633






Is c procedural or functional?

595


What does sizeof return c?

616


Where does the name "C" come from, anyway?

655


How is a null pointer different from a dangling pointer?

565


What is use of #include in c?

611


Which operators cannot be overloaded a) Sizeof b) .* c) :: d) all of the above

666


What is wrong with this program statement?

613


Study the following C program :call_me (myvar)int myvar;{ myvar +- 5; }main(){int myvar;myvar = 3;call_me(myvar);printf("%d ",myvar);What will be printed a) 3 b) 5 c) 8 d) symbol

674


how many errors in c explain deply

1637


Suggesting that there can be 62 seconds in a minute?

608