当前位置:网站首页>c语言如何判定是32位系统还是64位系统
c语言如何判定是32位系统还是64位系统
2022-07-07 18:01:00 【junxuezheng】
32位和64位指的是操作系统的位数,映射到C语言中,最直观的就是指针类型占用的字节数。
1、32位系统:
地址占32位,所以指针类型同样占32位,即4字节。
2、64位系统:
地址占64位,所以指针类型同样占64位,即8字节。
于是,只需要判断任意一个指针的sizeof值,即可获取到位数。
3、demo
#include <iostream>
using namespace std;
int main()
{
int bits = sizeof(char*);
if (bits == 4) printf("32位\n");
else if (bits == 8) printf("64位\n");
else printf("others, bits = %d\n", bits);
}
边栏推荐
- vulnhub之tre1
- Notes...
- pom. Brief introduction of XML configuration file label function
- openEuler 资源利用率提升之道 01:概论
- Introduction to bit operation
- Semantic slam source code analysis
- Openeuler prize catching activities, to participate in?
- ASP.NET幼儿园连锁管理系统源码
- CUDA versions are inconsistent, and errors are reported when compiling apex
- 力扣 643. 子数组最大平均数 I
猜你喜欢

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

ASP. Net learning & ASP's one word

Force buckle 2319 Judge whether the matrix is an X matrix

【STL】vector

开源OA开发平台:合同管理使用手册

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

Detailed explanation of Flink parallelism and slot

Sword finger offer II 013 Sum of two-dimensional submatrix

ASP. Net kindergarten chain management system source code
随机推荐
Version selection of boot and cloud
Sword finger offer II 013 Sum of two-dimensional submatrix
JVM GC垃圾回收简述
Flink并行度和Slot详解
力扣 989. 数组形式的整数加法
多个线程之间如何协同
LeetCode_ 7_ five
力扣 643. 子数组最大平均数 I
PMP practice once a day | don't get lost in the exam -7.7
Nunjuks template engine
torch.nn.functional.pad(input, pad, mode=‘constant‘, value=None)记录
831. KMP string
Interpretation of transpose convolution theory (input-output size analysis)
R语言dplyr包mutate_at函数和min_rank函数计算dataframe中指定数据列的排序序号值、名次值、将最大值的rank值赋值为1
RESTAPI 版本控制策略【eolink 翻译】
Force buckle 674 Longest continuous increasing sequence
强化学习-学习笔记8 | Q-learning
最多可以参加的会议数目[贪心 + 优先队列]
ASP. Net gymnasium integrated member management system source code, free sharing
Chapter 9 Yunji datacanvas was rated as 36 krypton "the hard core technology enterprise most concerned by investors"