当前位置:网站首页>Fundamentals of C language -- 2-2 const keywords and pointers
Fundamentals of C language -- 2-2 const keywords and pointers
2022-07-19 09:21:00 【Bazinga bingo】
const keyword , stay C It's used to modify variables in languages , Indicates that the variable is a constant .
const Used to decorate pointers , Yes 4 Ways of planting :
The first one is ,const int *p
p Not in itself const,p The variable that points to is const
The second kind ,int const *p
p Not in itself const,p The variable that points to is const
The third kind of ,int * const p
p Itself is const,p The variable pointed to is not const
A fourth ,const int * const p
p Itself is const,p The variable that you point to is also const
const The modified variable is in GCC In the environment , Variables can be changed . because const yes gcc Used to check to ensure implementation (const A variable of type cannot be changed. It is a compilation error , Not a running error . As long as you cheat the compiler, you can change , No error will be reported during operation ).GGC In distribution const Modify the variable memory space , Put it in the same modifiable space as ordinary variables .
const Mainly used to tell the compiler , This is const Modified variables do not have to be changed . It is more like passing information into the function in the future , Tell compilers and programmers that there is no need to change the value of variables .
边栏推荐
- MySql数据是如何存储在磁盘上存储的?
- uniapp仓库管理系统源码
- Day 7 Training
- MySQL 用户管理
- Static routing!! Static routing!! Static routing!!
- DEDECMS织梦保存当前栏目更改时失败的解决方法
- SSM实现一对一查询实战详细教程(一)
- [paper notes] Research on end positioning of grab manipulator based on multi-sensor data fusion
- [Hongke] Introduction to genicam protocol
- Understanding of user / Account / Account
猜你喜欢
Data Lake (20): Flink is compatible with iceberg, which is currently insufficient, and iceberg is compared with Hudi
C language compilation process
研究发现DNA纳米设备注射液可安全用于医疗用途
Solve interface cross domain problems and node operation MySQL
MySQL user management
Set the ID field to increase automatically when creating tables in SQL Server (Navicat demo)
目标检测模型大小计算,模型复杂度(参数换算公式)
Makefile中在命令前加上- 则忽略该命令产生的错误,继续执行下一条命令
【性能优化方法论系列】六、总结
LDA分类器
随机推荐
如何在监控主机上单独部署agent——WGCLOUD
C语言基础篇 —— 2-3 指针与数组
【微服务~高级】配置中心实战
ETCD数据库源码分析——初始化EtcdServer结构体
使用<pre>和JSON.stringify处理网页展示JSON的格式
如何快速计算生成模型的FID、IS、sFID、Precision、Recall等关键评价指标?
Programming in the novel [serial 13] the moon bends in the yuan universe
2022-07-16:以下go语言代码输出什么?A:[];B:[5];C:[5 0 0 0 0];D:[0 0 0 0 0]。 package main imp
Development utility
C# 读写文本,生成二维码
Set the ID field to increase automatically when creating tables in SQL Server (Navicat demo)
使用 Golang 正确处理五大互联网注册机构的 IP 数据
Jsp+servlet+mysql case
After working hard, I found that there were so many messes around
Etcd database source code analysis -- etcdserver bootstrap recover store from snapshot
Scope and lifecycle of beans
Pyodide 中实现网络请求的 3 种方法
DEDECMS织梦保存当前栏目更改时失败的解决方法
置顶随笔分类
DuiLib 实现tooltip自定义鼠标提示窗口