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 |
to convert a string without using decrement operater and string functions
What language is lisp written in?
Write a program to find given number is even or odd without using any control statement.
Is main() is used in the program,,see below example? void main() { int i; for(i=0;i<10;i++) main(); } Then what is the output of the program?
what is use#in c
identify the in correct expression a.a=b=3=4; b.a=b=c=d=0; float a=int b=3.5; d.int a; float b; a=b=3.5;
What is a pointer?
What is void main () in c?
What is a macro?
C passes By value or By reference?
5 Answers Geometric Software, Infosys,
how to create duplicate link list using C???
How to write the code of the program to swap two numbers with in one statement?