当前位置:网站首页>How C language determines whether it is a 32-bit system or a 64 bit system
How C language determines whether it is a 32-bit system or a 64 bit system
2022-07-07 20:11:00 【junxuezheng】
32 Bit and 64 Bit refers to the number of bits of the operating system , Mapping to C In language , The most intuitive is the number of bytes occupied by the pointer type .
1、32 Bit system :
Address 32 position , So the pointer type also accounts for 32 position , namely 4 byte .
2、64 Bit system :
Address 64 position , So the pointer type also accounts for 64 position , namely 8 byte .
therefore , You only need to judge the value of any pointer sizeof value , You can get the number of digits .
3、demo
#include <iostream>
using namespace std;
int main()
{
int bits = sizeof(char*);
if (bits == 4) printf("32 position \n");
else if (bits == 8) printf("64 position \n");
else printf("others, bits = %d\n", bits);
}
边栏推荐
- 九章云极DataCanvas公司获评36氪「最受投资人关注的硬核科技企业」
- 【剑指offer】剑指 Offer II 012. 左右两边子数组的和相等
- MIT science and technology review article: AgI hype around Gato and other models may make people ignore the really important issues
- Leetcode force buckle (Sword finger offer 36-39) 36 Binary search tree and bidirectional linked list 37 Serialize binary tree 38 Arrangement of strings 39 Numbers that appear more than half of the tim
- 九章云极DataCanvas公司摘获「第五届数字金融创新大赛」最高荣誉!
- 线性基
- Cloud 组件发展升级
- 关于自身的一些安排
- Automatic classification of defective photovoltaic module cells in electroluminescence images-論文閱讀筆記
- 力扣 599. 两个列表的最小索引总和
猜你喜欢
8 CAS
Classification automatique des cellules de modules photovoltaïques par défaut dans les images de lecture électronique - notes de lecture de thèse
Interpretation of transpose convolution theory (input-output size analysis)
Openeuler prize catching activities, to participate in?
整型int的拼接和拆分
openEuler 有奖捉虫活动,来参与一下?
【哲思与实战】程序设计之道
Cloud component development and upgrading
多个线程之间如何协同
力扣 2319. 判断矩阵是否是一个 X 矩阵
随机推荐
LeetCode_7_5
力扣 1037.有效的回旋镖
openEuler 有奖捉虫活动,来参与一下?
equals 方法
一键部署Redis任意版本
pom.xml 配置文件标签:dependencies 和 dependencyManagement 区别
kubernetes之创建mysql8
【mysql篇-基础篇】事务
R language ggplot2 visualization: use the ggecdf function of ggpubr package to visualize the grouping experience cumulative density distribution function curve, and the linetype parameter to specify t
The project manager's "eight interview questions" is equal to a meeting
pom.xml 配置文件标签作用简述
BI的边界:BI不适合做什么?主数据、MarTech?该如何扩展?
gorilla官方:golang开websocket client的示例代码
Chapter 9 Yunji datacanvas company won the highest honor of the "fifth digital finance innovation competition"!
Force buckle 459 Duplicate substring
最多可以参加的会议数目[贪心 + 优先队列]
第二十章 使用工作队列管理器(三)
Oracle 存儲過程之遍曆
Force buckle 1232 Dotted line
vulnhub之tre1