Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...


how to find your architecture is LittleEndian or BigEndian?



how to find your architecture is LittleEndian or BigEndian?..

Answer / 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

More C Interview Questions

How do I use void main?

0 Answers  


helllo sir give me some information of the basic information the c as printf ,scanf , %d ,%f and why is the main use of these.

3 Answers  


To what value are pointers initialized? 1) NULL 2) Newly allocated memory 3) No action is taken by the compiler to initialize pointers.

4 Answers   Aricent,


What is else if ladder?

0 Answers  


Is c still used in 2019?

1 Answers  






i have a written test in tomorrow

1 Answers   NNN, Value Labs,


write an algorithm which can find the largest number among the given list using binary search ............... this was asked in the interview

2 Answers   Satyam, UNIS, Wipro,


List some of the static data structures in C?

0 Answers  


Who had beaten up hooligan "CHAKULI" in his early college days?

1 Answers  


What is the difference between declaring a variable by constant keyword and #define ing that variable?

1 Answers  


What is the time and space complexities of merge sort and when is it preferred over quick sort?

0 Answers   Amazon,


What is bubble sort in c?

0 Answers  






Categories