指针数组和数组指针
2016-10-22 18:28
134 查看
指针数组:array of pointers, 数组中的元素都是指针,例如 char *p[10];
数组指针:a pointer to an array, 一个指向数组的指针,例如 char (*p)[10];
#include<iostream>
#include<vector>
using namespace std;
int main()
{
char *p[10];
cout<<sizeof(p)<<endl;
cout<<p<<endl;
cout<<p+1<<endl;
char (*pt)[10];
cout<<sizeof(pt)<<endl;
return 0;
}
输出:
80
0x7fff5fbff7c0
0x7fff5fbff7c8
8
Program ended with exit code: 0
数组指针:a pointer to an array, 一个指向数组的指针,例如 char (*p)[10];
#include<iostream>
#include<vector>
using namespace std;
int main()
{
char *p[10];
cout<<sizeof(p)<<endl;
cout<<p<<endl;
cout<<p+1<<endl;
char (*pt)[10];
cout<<sizeof(pt)<<endl;
return 0;
}
输出:
80
0x7fff5fbff7c0
0x7fff5fbff7c8
8
Program ended with exit code: 0
相关文章推荐
- 指针数组和数组指针,指针函数和函数指针
- 关于typedef,指针数组和数组指针,指针函数的说明
- 指针数组和数组指针分析
- C语言中的数组指针与指针数组
- 指针数组和数组指针的区别
- C语言学习笔记(6)-如何从变量声明的表面上来区分指针数组和数组指针
- 指针数组和数组指针
- 指针数组 数组指针 函数指针 函数指针数组 指向函数指针数组的指针的理解
- 数组指针与指针数组
- 数组指针和指针数组
- 指针数组和数组指针的区别
- 指针数组和数组指针的区别
- C语言 数组指针与指针数组
- 数组指针与指针数组
- 数组指针和指针数组的使用
- 指针数组和数组指针的区别
- 指针数组和数组指针
- 指针数组和数组指针分析
- 指针数组和数组指针的区别
- 指针数组,数组指针,函数指针,函数指针数组,指向函数指针数组的指针