当前位置:网站首页>C语言基础篇 —— 2-4 指针的数据类型含义和强制类型转换的解析
C语言基础篇 —— 2-4 指针的数据类型含义和强制类型转换的解析
2022-07-23 13:29:00 【Bazinga bingo】
指针的数据类型含义
一个指针涉及两个变量: 一个指针变量自己本身,一个是指针变量指向的那个变量
int *p
p(指针变量本身)是int * 类型,*p(指针指向的那个变量)是int类型
int *就是指针类型,只要是指针类型的都是占4个字节,解析方式都是按照地址的方式来解析的。所有的指针类型(不管是int *、char *、double *)的解析方式是相同的,都是地址。
对于指针所指向的那个变量来说,指针的类型很重要。指针指向的那个变量的类型(它所对应的内存空间的解析方法)要取决于指针类型。如指针是int *的,那么指针所指向的变量就是int类型的。
指针和强制类型转换
变量的数据类型含义
所有的类型数据存储在内存中,都是按照二进制格式存储的。所以内存中只有0和1,并不知道是int类型还是double类型。
int、char、short等属于整形,他们的存储当时(转换为二进制存入内存)是相同的,只是内存格子大小不同(所以这几种整形彼此兼容格式)。而float和double的存储方式彼此不同,和整形更不相同。
存进去的时候是按照这个变量本身的数据类型存储的。但是取出来时按照程序员以给定的数据类型进行解析取出。
C语言中的数据类型的本质,就是决定了这个数在内存中怎么存储的问题,也就是决定了这个数如何转成二进制的问题。内存只是个仓库,里面存储的都是1和0,不管里面0和1组合起来是什么意思。
边栏推荐
- Satisfiability of the equation of leetcode
- Summary of after class homework of Microcomputer Principle and technical interface
- 【31. 走迷宫(BFS)】
- 阿里平头哥CPU技术生态负责人陈炜:平头哥的发展之路
- How does MySQL query data that is not in the database?
- uni-app进阶之认证【day12】
- 浏览器四大内核
- C语言基础篇 —— 2-6 指针、数组与sizeof运算符
- SSD: Single Shot MultiBox Detector
- Detector: detect objects with recursive feature pyramid and switchable atolos convolution
猜你喜欢

Deep learning convolutional neural network paper study alexnet

中国化NFT?NFR横空出世

Priyanka Sharma, general manager of CNCF Foundation: read CNCF operation mechanism

Convolutional neural network model -- googlenet network structure and code implementation

【Web漏洞探索】SQL注入漏洞

微机原理与技术接口笔记

48:第五章:开发admin管理服务:1:创建子工程【imooc-news-dev-service-admin】,管理服务模块;

Tips and tricks for Neural Networks 深度学习训练神经网络的技巧总结(不定期更新)

The new business form of smart civil aviation has emerged, and Tupo digital twin has entered the civil aviation flight network of the Bureau

COPU副主席刘澎:中国开源在局部领域已接近或达到世界先进水平
随机推荐
Leetcode-168.excel table column name
Squeeze and incentive networks
Go interface: go deep into internal principles
面试官:生成订单30分钟未支付,则自动取消,该怎么实现?
一款非常棒的开源微社区轻论坛类源码
深度学习卷积神经网络论文研读-AlexNet
Bag of tricks for image classification "with convolutional neural networks"
Acquisition of positional reliability in accurate target detection
JS之闭包
微信小程序class绑定,怎么绑定2个变量
Visualization of gross domestic product (GDP) data
Using "soup.h1.text" crawler to extract the title will be one more\
SQL156 各个视频的平均完播率
实时疫情数据可视化分析
Heartless sword English Chinese bilingual poem 006. to my wife
【TensorFlow】检测TensorFlow GPU是否可用
Docker install redis
【无标题】
Squeeze-and-Excitation Networks(挤压和激励网络)
AutoCAD进阶操作