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
What is the total generic pointer type?
Is there a built-in function in C that can be used for sorting data?
any "C" function by default returns an a) int value b) float value c) char value d) a & b
What is sizeof c?
Does free set pointer to null?
Explain what is the difference between functions getch() and getche()?
What is the meaning of ?
Why is c faster?
What is the difference between #include and #include 'file' ?
Explain how can you be sure that a program follows the ansi c standard?
How is a structure member accessed?
Explain what is operator promotion?
What is difference between static and global variable in c?
What is array of structure in c?
What is the use of getchar functions?