![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++
IMBA鑫鑫
这个作者很懒,什么都没留下…
展开
-
[C++]静态持续变量static
复习自《C++ Primer Plus(第六版)中文版》1.静态持续变量(p309)和C语言一样,C++也为静态存储持续性变量提供了三种链接性:外部链接性(可在其他文件中访问)、内部链接性(只能在当前文件中访问)和无链接性(只能在当前函数或代码块中访问)。这三种链接性都在整个程序执行期间存在,与自动变量相比,它们的寿命更长。由于静态变量的数目在程序运行期间是不变的,因此程序不需要使用...原创 2019-03-25 10:57:04 · 681 阅读 · 0 评论 -
[C++]static和const区别
static的整理总结已经在static总结中写过,没看过的可以先去看一下。这里主要针对static和const在类中定义和调用的时候区别进行总结代码如下,已加上注释:#include<bits/stdc++.h>using namespace std;class testClass{ public: static int _datai;//不能在类内初始化 ...原创 2019-04-15 17:13:13 · 1961 阅读 · 0 评论 -
[c++]常量指针和指针常量区别
#include<bits/stdc++.h>using namespace std;int main(){ int a=10; int b=20; int e=40; const int* d=&b;//常量指针 cout<<"d:"<<d<<" "<<*d<<" "<<b<<...原创 2019-04-15 18:27:56 · 843 阅读 · 2 评论 -
[C++]sizeof各种情况详细分析+内存补齐机制
sizeof操作符的作用是返回一个对象或类型名的长度,返回值的类型为size_t,长度的单位是字节。sizeof表达式的结果是编译时常量。测试环境:win10 64位 dev c++先上几个基本数据类型short a;int b;float c;long d;double e;long long f;cout<<sizeof(a)<<endl;//...原创 2019-04-17 10:27:26 · 540 阅读 · 0 评论