当前位置:网站首页>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);
}
边栏推荐
- [sword finger offer] sword finger offer II 012 The sum of left and right subarrays is equal
- Force buckle 989 Integer addition in array form
- 力扣 989. 数组形式的整数加法
- TS快速入门-泛型
- Chapter 20 using work queue manager (3)
- Force buckle 459 Duplicate substring
- 力扣 88.合并两个有序数组
- mysql 的一些重要知识
- Creation of kubernetes mysql8
- Semantic SLAM源码解析
猜你喜欢
mock.js从对象数组中任选数据返回一个数组
最多可以参加的会议数目[贪心 + 优先队列]
有了ST7008, 蓝牙测试完全拿捏住了
Data island is the first danger encountered by enterprises in their digital transformation
论文解读(ValidUtil)《Rethinking the Setting of Semi-supervised Learning on Graphs》
Dynamic addition of El upload upload component; El upload dynamically uploads files; El upload distinguishes which component uploads the file.
The state cyberspace Office released the measures for data exit security assessment: 100000 information provided overseas needs to be declared
Opencv学习笔记 高动态范围 (HDR) 成像
ASP.NET学习& asp‘s one word
关于cv2.dnn.readNetFromONNX(path)就报ERROR during processing node with 3 inputs and 1 outputs的解决过程【独家发布】
随机推荐
Automatic classification of defective photovoltaic module cells in electroluminescence images-论文阅读笔记
Classification automatique des cellules de modules photovoltaïques par défaut dans les images de lecture électronique - notes de lecture de thèse
【STL】vector
Kubernetes——kubectl命令行工具用法详解
The state cyberspace Office released the measures for data exit security assessment: 100000 information provided overseas needs to be declared
MIT科技评论文章:围绕Gato等模型的AGI炒作可能使人们忽视真正重要的问题
Oracle 存儲過程之遍曆
Simulate the implementation of string class
论文解读(ValidUtil)《Rethinking the Setting of Semi-supervised Learning on Graphs》
Welcome to the markdown editor
开源重器!九章云极DataCanvas公司YLearn因果学习开源项目即将发布!
毕业季|遗憾而又幸运的毕业季
Interpretation of transpose convolution theory (input-output size analysis)
Force buckle 1961 Check whether the string is an array prefix
如何在软件研发阶段落地安全实践
R language dplyr package select function, group_ The by function, filter function and do function obtain the third largest value of a specific numerical data column in a specified level in a specified
Dynamic addition of El upload upload component; El upload dynamically uploads files; El upload distinguishes which component uploads the file.
Time tools
R language ggplot2 visualization: use the ggqqplot function of ggpubr package to visualize the QQ graph (Quantitative quantitative plot)
kubernetes之创建mysql8