- 博客(3)
- 收藏
- 关注
原创 指针与数组,指针数组与数组指针,函数指针和指针函数理解
什么是指针?什么是数组? 指针本身是一个变量,存储的是其他变量的地址。 如:int *p,a=0; p = &a; 数组是一种同类数据类型的集合,数组名为数组的首地址,&数组名则是数组的地址。 如:int a[4] = {0,1,2,3}; 2.指针数组和数组指针 数组指针:int (*p)[4]; //()的结合性高于[],则p是个指针,然后与[]结合,说明这是一个数组,即p是一个指向有4个整型数组的指针 指针数组:int *p[4]; //同理知,这是一个数组,数组中的数据元素全是指.
2020-07-01 22:09:14 160
原创 比较数组,vector对象和array对象
要了解数组,vector对象及array对象的相似与不同之处,结合以下示例分析: #include #include #include int main() { using namespace std; double a1[4] = {1.2,2.4,3.6,4.8}; vector<double> a2(4); a2[0] = 1.0/3.0; a2[1] = 1.0/5.0; a2[2] = 1.0/7.0; a2[3] = 1.0/9.0; array<double,4&
2020-07-01 21:19:46 160
原创 C++自我学习
1.第一个程序 include<iostream> using namespace std; int main() { //若无using namespace std,则以下输出应改为std :: cout <<”hello world” <<endl; cout << “hello world” << endl;//endl也可采用c旧式风格\n return 0; } iostream头文件:预处理...
2020-07-01 20:37:04 151
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人