EmbLogic's Blog

Write a program to check the underlying architecture of the system?

CODE:

#include<stdio.h>
union endian
{
int i;
unsigned char ch[4];

}e;
int main()
{
e.i=0XAABBCCDD;
if(e.ch[0]==0XDD)
{
printf(“Underlying architecture is Little endian\n”);
}
else
{
printf(“Underlying architecture is Bigendian\n”);

}
printf(“%#X\n”,e.i);
printf(“%#X\n”,e.ch[0]);
printf(“%#X\n”,e.ch[1]);
printf(“%#X\n”,e.ch[2]);
printf(“%#X\n”,e.ch[3]);
}

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>