Write a small C program to determine whether a machine's
type is little-endian or big-endian.
Answers were Sorted based on User's Feedback
Answer / vasundhara
int main()
{
int x=1;
if(*(char*)&x)
printf("little endian");
else
printf("big endian");
return 0;
}
| Is This Answer Correct ? | 7 Yes | 1 No |
Answer / anuraag
Vasudhara's solution is correct!
Still here is an alternative solution to check endianess
without using pointers...
int main()
{
int x=0x58;
char ch;
ch=x;
if(ch=0x58)
printf("Little Endian");
else
printf("Big Endian");
return 0;
}
| Is This Answer Correct ? | 3 Yes | 1 No |
Answer / mohana
The below code snipeet tells whether the system is little
or big endian.
int main()
{
int x=1;
if(x)
printf("big endian");
else
printf("little endian");
return 0;
}
| Is This Answer Correct ? | 7 Yes | 24 No |
what is the use of ‘auto’ keyword?
What is the maximum no. of arguments that can be given in a command line in C.?
write a function to swap an array a[5] elements like a[0] as a[5],a[1] as a[4],....a[5] as a[0].without using more than one loop and use one array not to use temp array?
consider the following structure: struct num nam{ int no; char name[25]; }; struct num nam n1[]={{12,"Fred"},{15,"Martin"},{8,"Peter"},{11,Nicholas"}}; ..... ..... printf("%d%d",n1[2],no,(*(n1 + 2),no) + 1); What does the above statement print? a.8,9 b.9,9 c.8,8 d.8,unpredictable value
How will you print TATA alone from TATA POWER using string copy and concate commands in C?
0 Answers Amdocs, Apps Associates,
difference between spiral and waterfall model
Write a program for Overriding.
write a c code "if you give a any decimal number then print that number in english alphabet"? ex: i/p: 552 o/p: five hundred fifty two ...
hello everybody can we change a the adress of a variabl i mean can i put for exemple for a int *p: &p=6 ?????????
Binary tree traversing
What is the value of c?
main() { printf("\n %d %d %d",sizeof('3'),sizeof("3"),sizeof(3)); } wat is the o/p and how?