当前位置:网站首页>写一个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;
}
边栏推荐
- Analysis of startup process of gazebo multi computer simulation
- Subnet division and subnet summary
- File operation io-part1
- Completabilefuture: from understanding to mastering, here are all you want to know
- 1.3 - 码制
- Variable parameters of go
- RSA and AES
- Jgaurora A8 configuration file
- Force buckle ------ replace blank space
- Simple example of class template
猜你喜欢

Who doesn't want a blog site of their own - build a blog site WordPress

Win10 /11 开热点无法上网问题

HuaWei满级大牛首次分享出这份598页网络协议全彩手册

Unable to access the Internet at win10 /11 hotspot

圖像處理7-圖像增强

Develop stylelint rules from zero (plug-ins)

Why does the verification code not refresh when clicked

Application of redis client list in practice

1.2(补充)
一个完整的性能测试流程
随机推荐
ES6 deconstruction assignment
从底层结构开始学习FPGA----RAM IP核及关键参数介绍
Pycharm shortcut key
Collections tool class (V)
与MQTT的初定情缘
Mariadb数据库的安装与初始化
IO streams (common streams)
ES6箭头函数
Unable to access the Internet at win10 /11 hotspot
RSA and AES
Multithreading advanced level
ES6解构赋值
Centos8 install redis
Installation and initialization of MariaDB database
【我的创作纪念日】一周年随笔
46. 全排列-dfs双百代码
Getting started with research
JS prototype chain object function relationship
Share problems solved
High performance distributed execution framework ray