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 |
what will be the output of this program........ main() { int a=2,b=4,c=6; printf("%d"); } why it gives the value of third variable.
what is the advantage of using SEMAPHORES to ORDINARY VARIABLES???
Do you know what are the properties of union in c?
Which one would you prefer - a macro or a function?
main() { unsigned int k = 987 , i = 0; char trans[10]; do { trans[i++] =(char) (k%16 > 9 ? k%16 - 10 + 'a' : '\0' ); } while(k /= 16); printf("%s\n", trans); }
how does the C compiler interpret the following two statements p=p+x; q=q+y; a.p=p+x; q=q+y b.p=p+xq=q+y c.p=p+xq; q=q+y d.p=p+x/q=q+y
What is the modulus operator?
where does malloc() function get the memory?
to convert a string without using decrement operater and string functions
write a program to generate 1st n fibonacci prime number
How can I handle floating-point exceptions gracefully?
What is the size of enum in bytes?