笔记
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(void)
{
// 数组指针 它是一个指针 指向一个数组的指针
#if 0
// method1
// 先定义数组类型,再定义指针
typedef int Buffer[1024];
Buffer *p = NULL;
int a[1024] = { 1 };
p = &a;
for (int i = 0; i < 1024; i++)
{
*((*p) + i) = i + 1;
}
for (int i = 0; i < 1024; i++)
{
printf("%d\n",(*p)[i]);
}
#endif
#if 0
// method2
// 直接定义数组指针类型 根据类型定义变量
typedef int(*P)[10];
int a[10] = { 1,2,3 };
P *p = &a;
for (int i = 0; i < 10; i++)
{
printf("%d\n",(*p)[i]);
}
#endif
// method3
// 直接定义数组指针变量p
int (*p) [10] = NULL;
int a[10] = { 1,2,3 };
p = &a;
system("pause");
return 0;
}