当前位置:网站首页>写一个C程序判断系统是大端字节序还是小端字节序
写一个C程序判断系统是大端字节序还是小端字节序
2022-06-30 06:30:00 【鄧二寶official】
Demo:
#include <stdio.h>
int check_sys(int a)
{
return *(char *)&a;
}
int main(int argc, char **argv)
{
int a = 1; /* 00 00 00 01 */
int ret = check_sys(a);
if(ret == 1) /* 01 */
{
printf("little endian\n");
}
else /* 00 */
{
printf("big endian\n");
}
return 0;
}
边栏推荐
猜你喜欢
随机推荐
Record a problem tracking of excessive load
不忘初心,能偷懒就偷懒:C#操作Word文件
uniapp 微信小程序返回上一页并刷新
Usage of case, casez and casex statements in Verilog
New project folder based on PIO plug-in in vscode -- Interpretation
银河麒麟初体验
文件操作IO-Part1
Connect to remote server
Mariadb数据库的安装与初始化
Go common judgments
Set in set (III)
HuaWei满级大牛首次分享出这份598页网络协议全彩手册
Docker is equipped with the latest MySQL image
C language final experiment report (student achievement management system) source code
深度学习---三好学生各成绩所占权重问题(3)
Static routing job
Installing googleplay environment on Huawei mobile phones
Wechat applet mall project
【微信小程序:单选、多选样式,背景色,圆角】
1.8 - 多级存储








