指针数组与数组指针、函数指针与指针函数
定义形式
指针数组与数组指针
int *p1[5];//指针数组
int (*p2)[5];//数组指针
函数指针与指针函数
int* fun(int a,int b);//指针函数
int (*fun)(int a,int b);//指针函数
区别与联系
- 本质
指针数组:本质是数组,元素为指针的数组,指针型的数组
数组指针:本质是指针,指向数组的指针,数组型的指针
指针函数:本质是函数,返回值是指针
函数指针:本质是指针,指向函数的指针,函数型的指针 - 示例(非标准)
int *p1[5];//指针数组 int *p1[5]={int*,int*,int*,int*,int*}
int (*p2)[5];//数组指针 *P2指向int [5]的数组