//转自:https://www.cnblogs.com/jianfeijiang/p/5914398.html
//
using namespace std;
int main(){
//a) 一个整型数( An integer)
int a;
//b) 一个指向整型数的指针( A pointer to an integer)
int *b;
//c) 一个指向指针的的指针,它指向的指针是指向一个整型数( A pointer to a pointer to an integer)
int **c;
//d) 一个有 10 个整型数的数组( An array of 10 integers)
int d[10];
//e) 一个有 10 个指针的数组,该指针是指向一个整型数的( An array of 10 pointers to integers)
int *e[10]
//f) 一个指向有 10 个整型数数组的指针( A pointer to an array of 10 integers)
int (*f)[10];
//g) 一个指向函数的指针,该函数有一个整型参数并返回一个整型数( A pointer to a functionthat takes an integer as an argument and returns an integer)
int *g(int);
//h) 一个有 10 个指针的数组,该指针指向一个函数,该函数有一个整型参数并返回一个整型数( An array of ten pointers to functions that take an integer argument and return an integer
int (*h[10])(int);
return 0;
}
对数组名取地址,是整个数组的地址
short tell[10]={1,2,3,4,5,6,7,8,9,0};
cout<<"先打印地址值:"<<endl;
cout<< tell << " , "<<&tell[0]<<endl;
cout<< &tell << endl<<endl;
cout<<"&tell[0] = "<<&tell[0]<<endl;
cout<<"&tell[1] = "<<&tell[1]<<endl<<endl;
cout<<"&tell[10] = "<<&tell[10]<<endl<<endl;
cout<<"然后打印tell+1的地址: "<<endl;
cout<<"tell+1: "<< tell+1<<endl;
cout<<"&tell+1: " << &tell+1 <<endl;
//比如
short (*pas)[20] = &tell; //这里pas是指向一个数组的指针。
//*pas 与tell是等价的。 即(*pas)[0]与tell[0]等价。