当前位置:网站首页>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);
}
边栏推荐
- 浅尝不辄止系列之试试腾讯云的TUIRoom(晚上有约,未完待续...)
- Data island is the first danger encountered by enterprises in their digital transformation
- 841. String hash
- gorilla官方:golang开websocket client的示例代码
- Graduation season | regretful and lucky graduation season
- Classification automatique des cellules de modules photovoltaïques par défaut dans les images de lecture électronique - notes de lecture de thèse
- CSDN syntax description
- RESTAPI 版本控制策略【eolink 翻译】
- LeetCode力扣(剑指offer 36-39)36. 二叉搜索树与双向链表37. 序列化二叉树38. 字符串的排列39. 数组中出现次数超过一半的数字
- Equals method
猜你喜欢

【STL】vector

vulnhub之school 1

数据孤岛是企业数字化转型遇到的第一道险关

模拟实现string类

Automatic classification of defective photovoltaic module cells in electroluminescence images-论文阅读笔记

整型int的拼接和拆分

Yolov6:yolov6+win10--- train your own dataset

vulnhub之Funfox2

Welcome to the markdown editor

Chapter 9 Yunji datacanvas company won the highest honor of the "fifth digital finance innovation competition"!
随机推荐
pom.xml 配置文件标签作用简述
MRS离线数据分析:通过Flink作业处理OBS数据
Kubernetes——kubectl命令行工具用法详解
Kubernetes -- detailed usage of kubectl command line tool
论文解读(ValidUtil)《Rethinking the Setting of Semi-supervised Learning on Graphs》
力扣 599. 两个列表的最小索引总和
JVM class loading mechanism
Chapter 20 using work queue manager (3)
mysql 的一些重要知识
A pot of stew, a collection of common commands of NPM and yarn cnpm
数据孤岛是企业数字化转型遇到的第一道险关
The state cyberspace Office released the measures for data exit security assessment: 100000 information provided overseas needs to be declared
vulnhub之tre1
The project manager's "eight interview questions" is equal to a meeting
【哲思与实战】程序设计之道
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
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
MIT science and technology review article: AgI hype around Gato and other models may make people ignore the really important issues
Oracle 存儲過程之遍曆
Force buckle 599 Minimum index sum of two lists