Write a small C program to determine whether a machine's
type is little-endian or big-endian.

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can we replace the struct function in tree syntax with a union?

1010


Ow can I insert or delete a line (or record) in the middle of a file?

780


Given below are three different ways to print the character for ASCII code 88. Which is the correct way1) char c = 88; cout << c << " ";2) cout.put(88);3) cout << char(88) << " "; a) 1 b) 2 c) 3 d) constant

909


Where in memory are my variables stored?

845


difference between Low, Middle, High Level languages in c ?

1851


write a C program: To recognize date of any format even formats like "feb-02-2003","02-february-2003",mm/dd/yy, dd/mm/yy and display it as mm/dd/yy.

3569


What is storage class?

850


How can I change the size of the dynamically allocated array?

889


What is NULL pointer?

859


What is the use of a conditional inclusion statement in C?

835


a way in which a pointer stores the address of a pointer which stores the value of the target value a) reference b) allocation c) multiple indirection d) none

876


What is a global variable in c?

775


When should we use pointers in a c program?

868


Describe the difference between = and == symbols in c programming?

1014


What is sizeof int?

837