willsun888
5/7/2013 - 6:31 AM

判断系统大端小端存储

判断系统大端小端存储

#include<stdio.h>
  union s{
  int i;
  char ch;
}c;
int check()
{
  c.i=1;
  return (c.ch);
}
void main()
{
  if (check())
  {
    printf("little\n");
  }
  else
    printf("big\n");
}