当前位置:网站首页>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);
}
边栏推荐
- Boot 和 Cloud 的版本选型
- R language ggplot2 visualization: use the ggdensity function of ggpubr package to visualize the packet density graph, and use stat_ overlay_ normal_ The density function superimposes the positive dist
- 【STL】vector
- 9 atomic operation class 18 Rohan enhancement
- ASP. Net kindergarten chain management system source code
- Force buckle 1037 Effective boomerang
- rk3128投影仪lcd显示四周显示不完整解决
- Some arrangements about oneself
- 力扣 2319. 判断矩阵是否是一个 X 矩阵
- 九章云极DataCanvas公司摘获「第五届数字金融创新大赛」最高荣誉!
猜你喜欢
随机推荐
开源重器!九章云极DataCanvas公司YLearn因果学习开源项目即将发布!
Welcome to the markdown editor
整型int的拼接和拆分
力扣 989. 数组形式的整数加法
About cv2 dnn. Readnetfromonnx (path) reports error during processing node with 3 inputs and 1 outputs [exclusive release]
torch.nn.functional.pad(input, pad, mode=‘constant‘, value=None)记录
CSDN语法说明
Gorilla official: sample code for golang to open websocket client
Equals method
Semantic SLAM源码解析
Openeuler prize catching activities, to participate in?
rk3128投影仪lcd显示四周显示不完整解决
Visual Studio 插件之CodeMaid自动整理代码
MRS离线数据分析:通过Flink作业处理OBS数据
JVM class loading mechanism
The state cyberspace Office released the measures for data exit security assessment: 100000 information provided overseas needs to be declared
vulnhub之school 1
mock.js从对象数组中任选数据返回一个数组
使用高斯Redis实现二级索引
mock. JS returns an array from the optional data in the object array








