Skip to content

TRUEANGLE

BEAUTY AND PLAY

  • DOLLECT
  • Others
  • Configuration
  • AI
  • BLOG
  • ABOUT
    • ABOUT
    • Perception Style

Daily Archives: July 11, 2014

How to write a program to find endianess of a machine ?

#include <stdio.h> #include <stdlib.h> static inline int little_endian() { int endian = 1; return (0 == (*(char *)&endian)); } int main (int argc, char **argv) { printf(“This machine is “); little_endian() ? printf(“little”) : printf(“big”); printf(” endian\n”); exit(0); }

Posted byjeffrinJuly 11, 2014Posted inC, operating system, Programming LanguagesTags: big indian, endianess, little endian
July 2014
M T W T F S S
 123456
78910111213
14151617181920
21222324252627
28293031  
« Jun   Aug »
TRUEANGLE, Proudly powered by WordPress.