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 best style for code layout in c?
What is the size of structure in c?
What is a floating point in c?
An application package has been provided to you without any documents for the following application. The application needs to be tested. How will you proceed?
In which language linux is written?
What are the differences between Structures and Arrays?
1. Write a function to display the sum of two numbers in the following ways: By using (i) pass by value (ii) pass by address a. function with argument and with return value b. function with argument and without return value c. without argument , with return value d. without argument , without return value Note: Use pass by address.
Can we declare variables anywhere in c?
How do you use a 'Local Block'?
What is this pointer in c plus plus?
#include main() { int *p, *c, i; i = 5; p = (int*) (malloc(sizeof(i))); printf(" %d",*p); *p = 10; printf(" %d %d",i,*p); c = (int*) calloc(2); printf(" %d ",*c); }
Is printf a keyword?
How do you define structure?
How can I rethow can I return a sequence of random numbers which dont repeat at all?
What are the different data types in C?