Search in shivacherukuri.tech@blogger.com

Sunday, February 20, 2011

FW: endianness of a machine?

 

 

  1 #include <stdio.h>

      2

      3 int main (int argc, char *argv[]) {

      4

      5   int i = 0x0001;

      6    if(*((char*)&i))

      7       printf("LITTLE");

      8    else

      9       printf ("BIG");

     10

     11   printf ("value is: %x %x", i, (char)i);

     12 }

No comments:

Post a Comment