1 Star 0 Fork 2

yutao1115 / Data-Structures-and-Algorithms-in-C

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
bigsmall.c 542 Bytes
一键复制 编辑 原始数据 按行查看 历史
leechanx 提交于 2014-12-15 20:58 . first
#include <stdio.h>
#include <limits.h>
void method1(){
int a=1;
char *p=&a;
if(*p)
printf("小端\n");
else
printf("大端\n");
}
union Test{
short a;
char b;
};
void method2(){
union Test test;
test.a=1;
if(test.b)
printf("小端\n");
else
printf("大端\n");
}
void method3(){
unsigned short limit=(USHRT_MAX+1)/2;
unsigned short a=0;
char name[1];
printf("输入2字节字符串!\n");
gets(name);
if(a>=limit)
printf("大端\n");
else
printf("小端\n");
}
main(){
method1();
method2();
method3();
}
C
1
https://gitee.com/yutao1115/Data-Structures-and-Algorithms-in-C.git
git@gitee.com:yutao1115/Data-Structures-and-Algorithms-in-C.git
yutao1115
Data-Structures-and-Algorithms-in-C
Data-Structures-and-Algorithms-in-C
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891