数组指针是一个指针,只对应类型的数组。指针数组是一个数组,其中每一个元素都是指针
数组指针遵循指针运算法则。指针数组拥有c语言数组的各类特性算法
C 经过 typedef 为数组类型 重命名数组
**格式 : **typedef type (name)[size]指针
typedef int (aint)[10]; typedef float (afloat)[10];
aint iarray; //定义了一个数组 afloat farray; //定义了一个数组
typedef int (*Paint)[10]; typedef float (*Pafloat)[10];
type(*pointer)[n]; //pointer 是一个指针,type表明指向的数组的类型,n为指向的数组的大小。
例:code
#include <stdio.h> typedef int (aint)[10]; //定义一个数组类型 typedef int (*Paint)[10]; //定义一个指针数组类型 int main() { int a[10] = {0}; aint myarr; myarr[0] = 8; printf("%d\n", myarr[0]); Paint Pmyarr; Pmyarr = &a; (*Pmyarr)[0] = 10; printf("%d\n", a[0]); int (*pointer)[10]; //定义一个指向数组类型的指针 pointer = &a; (*pointer)[0] = 20; printf("%d\n", a[0]); }