当前位置:网站首页>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);
}
边栏推荐
- Nunjuks template engine
- 【mysql篇-基础篇】事务
- R language uses ggplot2 function to visualize the histogram distribution of counting target variables that need to build Poisson regression model, and analyzes the feasibility of building Poisson regr
- School 1 of vulnhub
- 力扣 989. 数组形式的整数加法
- 【剑指offer】剑指 Offer II 012. 左右两边子数组的和相等
- 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
- 841. 字符串哈希
- 【STL】vector
- vulnhub之school 1
猜你喜欢
随机推荐
Training IX basic configuration of network services
R language ggplot2 visualization: use the ggqqplot function of ggpubr package to visualize the QQ graph (Quantitative quantitative plot)
Version selection of boot and cloud
torch.nn.functional.pad(input, pad, mode=‘constant‘, value=None)记录
力扣 459. 重复的子字符串
Flink并行度和Slot详解
Open source heavy ware! Chapter 9 the open source project of ylarn causal learning of Yunji datacanvas company will be released soon!
Sword finger offer II 013 Sum of two-dimensional submatrix
Equals method
YoloV6:YoloV6+Win10---训练自己得数据集
sql 常用优化
CUDA versions are inconsistent, and errors are reported when compiling apex
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
浅尝不辄止系列之试试腾讯云的TUIRoom(晚上有约,未完待续...)
vulnhub之tre1
Some arrangements about oneself
编译器优化那些事儿(4):归纳变量
力扣 1790. 仅执行一次字符串交换能否使两个字符串相等
pom.xml 配置文件标签:dependencies 和 dependencyManagement 区别
The DBSCAN function of FPC package of R language performs density clustering analysis on data, checks the clustering labels of all samples, and the table function calculates the two-dimensional contin