当前位置:网站首页>Assert and constd13
Assert and constd13
2022-06-26 13:54:00 【Apple ADC】
assert:assert( expression ); If the expression is true, nothing will be done , If false, the program crashes , And remind the crash location , stay debug The version is valid ,release Automatic failure
Assertions need to reference the assertion header file :#include<assert.h>
const: Define constant variable
1. Basic types for const It's transparent
const int ca=10; and int const cb=10; Equivalent
2.const Just decorate the right side , Make it read-only
3. Authority can only be transmitted equally or reduced
int main()
{
int a=10;// Can read but write
a=20;//a Yes.
int b=a;//a Yes.
const int ca=10;// read-only
b=ca;
ca=20;// Report errors
int *p=&a;
p=&b;
*p=100;
const int *cp1=&a;
cp1=&b;// correct
*cp1=100;// Report errors
int const *cp2=&a;
cp2=&b;// correct
*cp2=100;// Report errors
int *const cp3=&a;
cp3=&b;// Report errors
*cp3=100; // correct
} int main()
{
int a=10;
int b=20;
const int ca=10;
const int cb=20;
int *p1=&a;// correct
*p1=100;
p1=&b;
int *p2=&ca;// Report errors *p2=100; Dereference indirect to ca assignment
const int *p3=&a;
const int *p4=&ca;// Report errors ,*p4 Dereference
*p4=100;// Report errors
int *const p5=&a;
int *const p6=&ca;// Report errors
const int *const p7=&a;
}边栏推荐
猜你喜欢

Hands on data analysis unit 3 model building and evaluation

Stack, LIFO

古瑞瓦特沖刺港交所上市:創下“多個第一”,獲IDG資本9億元投資

awk工具

Thinking caused by the error < note: candidate expectations 1 argument, 0 provided >

Ring queue PHP

Nexys A7开发板资源使用技巧

Generation and rendering of VTK cylinder

ES基于Snapshot(快照)的数据备份和还原

There are many contents in the widget, so it is a good scheme to support scrolling
随机推荐
Cloudcompare - Poisson reconstruction
Wechat applet -picker component is repackaged and the disabled attribute is added -- above
Exercise set 1
KITTI Detection dataset whose format is letf_ top_ right_ bottom to JDE normalied xc_ yc_ w_ h
d的is表达式
Mysql database explanation (IV)
Mediapipe gestures (hands)
awk工具
Select tag - uses the default text as a placeholder prompt but is not considered a valid value
泰山OFFICE技术讲座:使用字体粗体的四种情形
DataGrip配置的连接迁移
imagecopymerge
Awk tools
ES6 module
7-2 the cubic root of a number
Hands on data analysis unit 3 model building and evaluation
Global variable vs local variable
d检查类型是指针
Bug memory management
Lamp compilation and installation