当前位置:网站首页>6. const usage, combination of first and second level pointers
6. const usage, combination of first and second level pointers
2022-06-23 01:40:00 【For financial freedom!】

C file :
It's all printed out 30,const The amount of modification is called a constant ! Cannot be an array parameter !
C++ file :
C++ in , All appear const Where constant names are , Are replaced by the initialization of constants !( Refer to detai C++ Anatomy column , It involves the concept of constant table !) Design to constants at compile time a Is replaced by a constant !
const Combined with one or two level pointers
sonst The common mistake in the amount of decoration is :
- Constants can no longer be used as lvalues
- The address of a constant cannot be disclosed to an ordinary pointer or ordinary reference variable ( You can modify the value of a constant indirectly !)
C++ language norm :const It's the type closest to him !
first line :*p Cannot be used as an lvalue :*p=20 error ,p=&b Sure (const Modification is int type )
The second line : Same as the first line , Modification is int
The third line : Modification is int * , in other words p Is a constant , Cannot point to other memory !*p Assignable ( Modify the value of the memory pointed to through pointer dereference )
In the fourth row : first const modification int(*p), The second modification int*(p)!
const Sum up the formula :
const If there is no pointer on the right * Words ,const It's a non participating type !
The above is wrong , Will report a mistake !
边栏推荐
- Thead safety experience
- JS prototype and prototype chain Paramecium can understand
- 278. digital combination
- 时间复杂度
- [ZOJ] P3228 Searching the String
- Time complexity
- MySQL basic command statement
- Summary of the first week of winter vacation
- Debian10 configuring rsyslog+loganalyzer log server
- Pat a - 1010 radical (thinking + two points)
猜你喜欢

基于深度学习的视觉目标检测技术综述

Explain the startup process of opengauss multithreading architecture in detail

LeetCode 206. Reverse linked list (iteration + recursion)

Huawei cloud recruits partners in the field of industrial intelligence to provide strong support + commercial realization

ERROR { err: YAMLException: end of the stream or a document separator is expected at line 6, colum

E-R图

Local deployment and problem solving of IIS in ArcGIS JS 4.23

New progress in the construction of meituan's Flink based real-time data warehouse platform
![Found several packages [runtime, main] in ‘/usr/local/Cellar/go/1.18/libexec/src/runtime;](/img/75/d2ad171d49611a6578faf2d390af29.jpg)
Found several packages [runtime, main] in ‘/usr/local/Cellar/go/1.18/libexec/src/runtime;

Using WordPress to create a MySQL based education website (learning notes 2) (technical notes 1) xampp error1045 solution
随机推荐
Centos7 installing postgresql12
Day500: keyboard line
3D打印微组织
[template] KMP
JS prototype and prototype chain Paramecium can understand
基于深度学习的视觉目标检测技术综述
Autumn move script B
Byte order: big endian vs little endian
Huawei cloud recruits partners in the field of industrial intelligence to provide strong support + commercial realization
JS to determine whether the browser has opened the console
ERROR { err: YAMLException: end of the stream or a document separator is expected at line 6, colum
278. digital combination
On AI and its future trend | community essay solicitation
HDU - 7072 double ended queue + opposite top
Pat class A - 1014 waiting in line (bank queuing problem | queue+ simulation)
Pat class A - 1013 battle over cities
Google benchmark user manual and examples
Day260: the number III that appears only once
Dual cross domain: access allow origin header contains multiple values "*, *", but only one is allowed
崔鹏团队:万字长文梳理「稳定学习」全景图