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 |
Explain what is the difference between far and near ?
what are the facialities provided by you after the selection of the student.
Describe static function with its usage?
What are global variables?
Are pointers really faster than arrays?
what is the first address that gets stored in stack according to a C or C++ compiler???? or what will be the first address that gets stored when we write a C source code????????
Explain how does flowchart help in writing a program?
What are multidimensional arrays?
What is a sequential access file?
typedef struct { int i:8; char c:9; float f:20; }st_temp; int getdata(st_temp *stptr) { stptr->i = 99; return stptr->i; } main() { st_temp local; int i; local.c = 'v'; local.i = 9; local.f = 23.65; printf(" %d %c %f",local.i,local.c,local.f); i = getdata(&local); printf("\n %d",i); getch(); } why there there is an error during compiling the above program?
Input is "Jack and jill went up a hill" To print output is 1-letter word(s)-1 2-letter words-1 3-letter words-1 4-letter words-4
How would you rename a function in C?